Skip to content

Commit

Permalink
fix fact gathering when unicast is enable
Browse files Browse the repository at this point in the history
  • Loading branch information
ggambini committed Mar 6, 2023
1 parent 396c249 commit f249fdf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ Requirements

Supporte Red Hat 7 et 8. Testé avec keepalived 1.3.5 et 2.0.10.

Attention, si unicast actif alors le playbook a besoin des anisble_facts de l'ensemble des serveurs keepalived (à cause des peer address à remplir dans le fichier de conf). En d'autres termes, en unicast, il faut exécuter le playbook sur tous les LB en même temps (pas de serial 1).

Mode failover : Role Variables
--------------

Expand Down
21 changes: 11 additions & 10 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
- name: When unicast enable, gather facts from hosts regardless of limit or tags
setup:
delegate_to: "{{ item }}"
delegate_facts: True
when:
- hostvars[item]['ansible_default_ipv4'] is not defined
- keepalived_unicast|default(false)|bool
with_items:
- "{{ keepalived_master }}"
- "{{ keepalived_backup }}"
tags: always
block:
- name: "Get fact for {{ item }}"
setup:
delegate_to: "{{ item }}"
delegate_facts: True
when: hostvars[item]['ansible_default_ipv4'] is not defined
with_items:
- "{{ keepalived_master }}"
- "{{ keepalived_backup }}"

when: keepalived_unicast|default(false)|bool

- name: Main configuration file from template
template:
Expand Down

0 comments on commit f249fdf

Please sign in to comment.