Configure keepalived with Ansible the way you want
ISC License
This role configures keepalived without arm twisting. Write the configuration the way you want.
Automatic testing is provided using molecule's delegated driver and https://builds.sr.ht.
Another role or deployment method must be devised to use notification scripts such as notify_backup
, notify_fault
and notify_master
.
keepalived_global_defs
: configure the global_defs
block ;keepalived_vrrp_scripts
: configure one or more vrrp_script
;keepalived_vrrp_instances
: configure one or more vrrp_instance
.keepalived_virtual_servers
: configure one or more virtual_servers
.keepalived_vrrp_sync_group
: configure one or more vrrp_sync_group
.keepalived_flags
: flags to pass to the keepalived daemon (set --log-detail --log-facility=7
by default)The keepalived
package should be installed first using a tool such as Packer.
However if it is not part of your toolchain the variable keepalived_install
can be set to True
to provoke an installation.
- hosts: wwwmaster
vars:
- keepalived_global_defs: |
router_id 1
- keepalived_vrrp_scripts:
- name: haproxy
content: |
script "killall -0 haproxy"
- keepalived_vrrp_instances:
- name: HAPROXY
content: |
virtual_router_id 42
state MASTER
unicast_src_ip "{{ master_ip }}"
unicast_peer {
"{{ backup_ip }}"
}
interface eth0
virtual_ipaddress {
"{{ vip_front }}"
}
track_script {
haproxy
}
- keepalived_vrrp_sync_group:
- name: VRRP-GRP-01
vrrp_group_instances_member:
- HAPROXY
- WEB
roles:
- role: ansible-keepalived
ISC
Either send send GitHub pull requests or send patches on SourceHut.
This role was created in 2018 by Tristan Le Guern on the behalf of Deveryware.