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

47 lines
1007 B

9 months ago
- name: Setup HAProxy
hosts: all
become: yes
become_method: sudo
become_user: root
tasks:
- name: Install package
package:
name: haproxy
state: present
- name: Start HAProxy
service:
name: haproxy
enabled: true
9 months ago
state: started
- name: Install keepalived
package:
name: keepalived
state: present
- name: Start keepalived
service:
name: keepalived
enabled: true
state: started
- name: Config keepalived
blockinfile:
dest: /etc/keepalived/keepalived.conf
block: |
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 101
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.10.0.2
}
}
vrrp_script chk_apiserver {
script "/usr/bin/nc localhost 6443"
interval 5
}