Skip to content

Commit

Permalink
Merge pull request #43 from jidckii/feature/didable-vip-manager-if-ru…
Browse files Browse the repository at this point in the history
…n-keepalived

Disable vip-manager if run keepalived
  • Loading branch information
vitabaks committed Jul 31, 2020
2 parents 48f8193 + 9c90929 commit 64dcdae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions balancers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- vars/main.yml
- vars/system.yml
- "vars/{{ ansible_os_family }}.yml"
vars:
vip_manager_disable: false # or 'true' for disable vip-manager service (if installed)

pre_tasks:
- name: Checking Linux distribution
Expand Down Expand Up @@ -68,6 +70,9 @@
- role: confd
when: dcs_type == "etcd"

- role: vip-manager-disable
when: vip_manager_disable|bool

- role: keepalived
when: cluster_vip is defined and cluster_vip | length > 0

Expand Down
7 changes: 7 additions & 0 deletions roles/vip-manager-disable/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Disabe vip-manager service
systemd:
daemon_reload: true
name: vip-manager
state: stopped
enabled: false
3 changes: 3 additions & 0 deletions roles/vip-manager/templates/vip-manager.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Type=simple

ExecStart=/usr/bin/vip-manager -config={{ vip_manager_conf }}

# VIP not released when service stopped https://github.com/cybertec-postgresql/vip-manager/issues/19
ExecStopPost=/sbin/ip addr del {{ vip_manager_ip }}/{{ vip_manager_mask }} dev {{ vip_manager_iface }}

Restart=on-failure

[Install]
Expand Down

0 comments on commit 64dcdae

Please sign in to comment.