- name: Setup HAProxy hosts: all become: yes become_method: sudo become_user: root tasks: - name: Install pacemaker package: name: pacemaker state: present - name: Install corosync package: name: corosync state: present - name: Install pcs package: name: pcs state: present - name: Install fence-agents package: name: fence-agents state: present - name: append hosts to etc_hosts blockinfile: state: present dest: /etc/hosts content: | {% for host in groups.all %} {{ host }} {{ hostvars\[host\]\['hostname'\] }} {% endfor %} - name: Start pcsd service: name: pscd enabled: true state: started - name: Install package package: name: haproxy state: present - name: Start HAProxy service: name: haproxy enabled: true state: started