diff --git a/tasks/main.yml b/tasks/main.yml index 47528e2..608d994 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -130,6 +130,18 @@ notify: - reload keepalived +- name: Dropping the notification scripts for lower priority master case + copy: + src: "{{ item.value.src_notify_master_rx_lower_pri }}" + dest: "{{ item.value.notify_master_rx_lower_pri }}" + mode: "0755" + with_dict: "{{ keepalived_sync_groups }}" + when: item.value.src_notify_master_rx_lower_pri is defined + tags: + - keepalived-config + notify: + - reload keepalived + - name: Dropping the notification scripts for switching to backup copy: src: "{{ item.value.src_notify_backup }}" @@ -178,6 +190,18 @@ notify: - reload keepalived +- name: Dropping the notification scripts for lower priority master case (instances) + copy: + src: "{{ item.value.src_notify_master_rx_lower_pri }}" + dest: "{{ item.value.notify_master_rx_lower_pri }}" + mode: "0755" + with_dict: "{{ keepalived_instances }}" + when: item.value.src_notify_master_rx_lower_pri is defined + tags: + - keepalived-config + notify: + - reload keepalived + - name: Dropping the notification scripts for switching to backup (instances) copy: src: "{{ item.value.src_notify_backup }}" diff --git a/templates/keepalived.conf.j2 b/templates/keepalived.conf.j2 index db707e7..93b4918 100644 --- a/templates/keepalived.conf.j2 +++ b/templates/keepalived.conf.j2 @@ -36,6 +36,9 @@ vrrp_sync_group {{ name }} { {% if sync_group.notify_master is defined %} notify_master "{{ sync_group.notify_master }}" {% endif %} + {% if sync_group.notify_master_rx_lower_pri is defined %} + notify_master_rx_lower_pri "{{ sync_group.notify_master_rx_lower_pri }}" + {% endif %} {% if sync_group.notify_backup is defined %} notify_backup "{{ sync_group.notify_backup }}" {% endif %} @@ -155,6 +158,9 @@ vrrp_instance {{ name }} { {% if instance.notify_master is defined %} notify_master "{{ instance.notify_master }}" {% endif %} + {% if instance.notify_master_rx_lower_pri is defined %} + notify_master_rx_lower_pri "{{ instance.notify_master_rx_lower_pri }}" + {% endif %} {% if instance.notify_backup is defined %} notify_backup "{{ instance.notify_backup }}" {% endif %} diff --git a/tests/keepalived_haproxy_backup_example.yml b/tests/keepalived_haproxy_backup_example.yml index 9ac72f1..a6a9b57 100644 --- a/tests/keepalived_haproxy_backup_example.yml +++ b/tests/keepalived_haproxy_backup_example.yml @@ -34,6 +34,8 @@ keepalived_sync_groups: # Their deployment and configuration are like the notify_script #notify_master: #src_notify_master: + #notify_master_rx_lower_pri: + #src_notify_master_rx_lower_pri: #notify_backup: #src_notify_backup: #notify_fault: diff --git a/tests/keepalived_haproxy_master_example.yml b/tests/keepalived_haproxy_master_example.yml index ff0aaaa..0b6a99b 100644 --- a/tests/keepalived_haproxy_master_example.yml +++ b/tests/keepalived_haproxy_master_example.yml @@ -34,6 +34,8 @@ keepalived_sync_groups: # Their deployment and configuration are like the notify_script #notify_master: #src_notify_master: + #notify_master_rx_lower_pri: + #src_notify_master_rx_lower_pri: #notify_backup: #src_notify_backup: #notify_fault: @@ -66,7 +68,7 @@ keepalived_instances: state: MASTER virtual_router_id: 10 priority: 100 - #Optional, VRRP Advert interval in seconds + #Optional, VRRP Advert interval in seconds #advert_int: 1 # Please set this if you want to use a virtual MAC address. #use_vmac: true @@ -165,7 +167,7 @@ keepalived_instances: # bindto: '10.0.0.2' # # Optional, fwmark to mark all outgoing checker packets with # fwmark: 2 -# # Optional, random delay to start the initial check +# # Optional, random delay to start the initial check # warmup: 2 # http_get: # - url_path: '/' @@ -182,7 +184,7 @@ keepalived_instances: # bindto: '10.0.0.2' # # Optional, Optional fwmark to mark all outgoing checker packets with # fwmark: 2 -# # Optional random delay to start the initial check +# # Optional random delay to start the initial check # warmup: 2 # tcp_checks: # #Port to connect to @@ -199,7 +201,7 @@ keepalived_instances: # bindto: '10.0.0.2' # # Optional, fwmark to mark all outgoing checker packets with # fwmark: 2 -# # Optional, random delay to start the initial check +# # Optional, random delay to start the initial check # warmup: 2 # dns_checks: # # IP to connect to @@ -221,7 +223,7 @@ keepalived_instances: # # # # Define Keepalived Virtual Server Groups -# +# #keepalived_virtual_server_groups: # - name: server_group_1 # # Multiple VIPs (configured in keepalived_instances) are allowed, incl. IP Ranges