Compare commits
2 Commits
584ebe42e5
...
3b0394a7a5
Author | SHA1 | Date | |
---|---|---|---|
3b0394a7a5 | |||
b002228685 |
13
README.md
13
README.md
@ -52,6 +52,19 @@ Adresse IPv6 de failover.
|
|||||||
|
|
||||||
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
||||||
|
|
||||||
|
### keepalived_peers
|
||||||
|
|
||||||
|
Passer en unicast en utilisant cette liste d'IP.
|
||||||
|
|
||||||
|
*<span style="text-decoration: underline">Valeur par défaut:</span> aucune*
|
||||||
|
|
||||||
|
### keepalived_notify
|
||||||
|
|
||||||
|
Dictionnaire comportant des booléens permettant d'activer les scripts en fonction de l'état.<br>
|
||||||
|
Les scripts sont déployés dans `/srv/keepalived/notify_{master,backup,fault,stop}.sh`.
|
||||||
|
|
||||||
|
*<span style="text-decoration: underline">Valeur par défaut:</span> `false` (pour chaque état)*
|
||||||
|
|
||||||
### keepalived_track_scripts
|
### 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.
|
Liste de script dont le code retour doit être à zéro pour que le membre conserve ou puisse prendre l'IP de failover.
|
||||||
|
@ -11,6 +11,14 @@ keepalived_mail_from: ""
|
|||||||
keepalived_ipv4: ""
|
keepalived_ipv4: ""
|
||||||
keepalived_ipv6: ""
|
keepalived_ipv6: ""
|
||||||
|
|
||||||
|
keepalived_peers: []
|
||||||
|
|
||||||
|
keepalived_notify:
|
||||||
|
- master: false
|
||||||
|
- backup: false
|
||||||
|
- fault: false
|
||||||
|
- stop: false
|
||||||
|
|
||||||
keepalived_track_scripts: []
|
keepalived_track_scripts: []
|
||||||
# Exemple:
|
# Exemple:
|
||||||
# - name: check_haproxy_8080
|
# - name: check_haproxy_8080
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# tasks file for keepalived
|
# tasks file for keepalived
|
||||||
|
|
||||||
- name: Installer keepalived
|
- name: Installer le paquet
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
name: keepalived
|
name: keepalived
|
||||||
become: true
|
become: true
|
||||||
@ -15,3 +15,23 @@
|
|||||||
dest: /etc/keepalived/keepalived.conf
|
dest: /etc/keepalived/keepalived.conf
|
||||||
become: true
|
become: true
|
||||||
notify: Redémarrer keepalived.service
|
notify: Redémarrer keepalived.service
|
||||||
|
|
||||||
|
- name: Créer le dossier de déploiement des scripts
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /srv/keepalived
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rwX,g=rX,o=
|
||||||
|
state: directory
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Déployer les scripts
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: keepalived/notify_{{ state }}.sh
|
||||||
|
dest: /srv/keepalived/
|
||||||
|
mode: u=r,g=r,o=
|
||||||
|
loop: "{{ keepalived_notify }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: state
|
||||||
|
become: true
|
||||||
|
notify: Redémarrer keepalived.service
|
||||||
|
@ -40,6 +40,12 @@ vrrp_instance VIP_{{ keepalived_uid }} {
|
|||||||
virtual_router_id {{ keepalived_uid }}
|
virtual_router_id {{ keepalived_uid }}
|
||||||
advert_int 1
|
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 %}
|
{% if keepalived_ipv4 | length > 0 %}
|
||||||
virtual_ipaddress {
|
virtual_ipaddress {
|
||||||
{{ keepalived_ipv4 }} dev {{ keepalived_interface }} scope global
|
{{ keepalived_ipv4 }} dev {{ keepalived_interface }} scope global
|
||||||
@ -52,6 +58,19 @@ vrrp_instance VIP_{{ keepalived_uid }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if keepalived_notify_master | length > 0 %}
|
||||||
|
notify_master {{ keepalived_notify_master.dst }}
|
||||||
|
{% endif %}
|
||||||
|
{% if keepalived_notify_backup | length > 0 %}
|
||||||
|
notify_master {{ keepalived_notify_backup.dst }}
|
||||||
|
{% endif %}
|
||||||
|
{% if keepalived_notify_fault | length > 0 %}
|
||||||
|
notify_master {{ keepalived_notify_fault.dst }}
|
||||||
|
{% endif %}
|
||||||
|
{% if keepalived_notify_stop | length > 0 %}
|
||||||
|
notify_master {{ keepalived_notify_stop.dst }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if keepalived_track_scripts | length > 0 %}
|
{% if keepalived_track_scripts | length > 0 %}
|
||||||
track_script {
|
track_script {
|
||||||
{% for script in keepalived_track_scripts %}
|
{% for script in keepalived_track_scripts %}
|
||||||
|
Loading…
Reference in New Issue
Block a user