You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
homelab/haproxy.yml

44 lines
926 B

- 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