diff --git a/roles/keepalived/tasks/main.yml b/roles/keepalived/tasks/main.yml index d3580c4ff..1f937e084 100644 --- a/roles/keepalived/tasks/main.yml +++ b/roles/keepalived/tasks/main.yml @@ -1,8 +1,4 @@ -- name: Install procps-ng - yum: - name: procps-ng - state: present - +--- - name: Ensure nonlocal ipv4 bind kernel parameter is set sysctl: name: net.ipv4.ip_nonlocal_bind @@ -14,9 +10,10 @@ group: name: mysqlusers state: present + when: "'dbcluster_nodes' in group_names" - name: Install keepalived - yum: + package: name: keepalived state: present register: keepalived_package_installed diff --git a/roles/keepalived/templates/keepalived_loadbalancer.conf.j2 b/roles/keepalived/templates/keepalived_loadbalancer.conf.j2 index 559507ae6..cbd842743 100644 --- a/roles/keepalived/templates/keepalived_loadbalancer.conf.j2 +++ b/roles/keepalived/templates/keepalived_loadbalancer.conf.j2 @@ -14,7 +14,7 @@ vrrp_script chk_maint { vrrp_instance ipv4 { interface {{ ansible_default_ipv4.interface }} # interface to monitor state {{ keepalived.state_master }} - virtual_router_id 55 # Assign one ID for this route + virtual_router_id {{ vrrp_id_ipv4 }} # Assign one ID for this route priority {{ keepalived.masterprio }} # 101 on master, 100 on backup advert_int 1 authentication { @@ -35,9 +35,13 @@ vrrp_instance ipv4 { vrrp_instance ipv6 { interface {{ ansible_default_ipv4.interface }} state {{ keepalived.state_backup }} - virtual_router_id 56 + virtual_router_id {{ vrrp_id_ipv6 }} priority {{ keepalived.backupprio }} - advert_int 5 + advert_int 1 + authentication { + auth_type PASS + auth_pass {{ keepalived_loadbalancer_vrrp_password }} + } virtual_ipaddress { {% if haproxy_sni_ip.ipv6 is defined %} {{ haproxy_sni_ip.ipv6 }}