Skip to content

Commit

Permalink
Merge pull request #166 from eifelmicha/master
Browse files Browse the repository at this point in the history
Add config option "notify_master_rx_lower_pri"
  • Loading branch information
evrardjp authored Jan 4, 2021
2 parents 399654c + 6a3fdd5 commit 878d63a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
24 changes: 24 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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 }}"
Expand Down
6 changes: 6 additions & 0 deletions templates/keepalived.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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 %}
Expand Down
2 changes: 2 additions & 0 deletions tests/keepalived_haproxy_backup_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 7 additions & 5 deletions tests/keepalived_haproxy_master_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: '/'
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 878d63a

Please sign in to comment.