From e31eb16ac7296ff5fd89ed1ad9aacafa0c3e6bec Mon Sep 17 00:00:00 2001 From: "pulsar89.5" Date: Fri, 21 Apr 2023 14:28:05 +0200 Subject: [PATCH] [FUNC] Ajouter la gestion de l'unicast --- README.md | 6 ++++++ defaults/main.yml | 2 ++ templates/keepalived.j2 | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index b319f73..c2eea88 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,12 @@ Adresse IPv6 de failover. *Valeur par défaut: aucune* +### keepalived_peers + +Passer en unicast en utilisant cette liste d'IP. + +*Valeur par défaut: aucune* + ### keepalived_track_scripts Liste de script dont le code retour doit être à zéro pour que le membre conserve ou puisse prendre l'IP de failover. diff --git a/defaults/main.yml b/defaults/main.yml index 1c1a385..6b2b021 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -11,6 +11,8 @@ keepalived_mail_from: "" keepalived_ipv4: "" keepalived_ipv6: "" +keepalived_peers: [] + keepalived_track_scripts: [] # Exemple: # - name: check_haproxy_8080 diff --git a/templates/keepalived.j2 b/templates/keepalived.j2 index 4acb3bb..2e2e2d8 100644 --- a/templates/keepalived.j2 +++ b/templates/keepalived.j2 @@ -40,6 +40,12 @@ vrrp_instance VIP_{{ keepalived_uid }} { virtual_router_id {{ keepalived_uid }} advert_int 1 +{% if keepalived_peers | length > 0 %} + unicast_peer { + {{ keepalived_peers | join('\n') | indent(width=4, indent=True) }} + } +{% endif %} + {% if keepalived_ipv4 | length > 0 %} virtual_ipaddress { {{ keepalived_ipv4 }} dev {{ keepalived_interface }} scope global