Compare commits
4 Commits
ef4a4fcba4
...
0d4cd47771
Author | SHA1 | Date | |
---|---|---|---|
0d4cd47771 | |||
54e2b70bd6 | |||
0efc0c6887 | |||
954528bd4d |
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_script_enabled
|
||||||
|
|
||||||
|
Booléen permettant d'activer le script de notification.<br>
|
||||||
|
Le script est déployé dans `/etc/keepalived/notify.sh`.
|
||||||
|
|
||||||
|
*<span style="text-decoration: underline">Valeur par défaut:</span> `false`*
|
||||||
|
|
||||||
### 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,10 @@ keepalived_mail_from: ""
|
|||||||
keepalived_ipv4: ""
|
keepalived_ipv4: ""
|
||||||
keepalived_ipv6: ""
|
keepalived_ipv6: ""
|
||||||
|
|
||||||
|
keepalived_peers: []
|
||||||
|
|
||||||
|
keepalived_notify_script_enabled: 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,25 @@
|
|||||||
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: Déployer les scripts
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: keepalived/notify.sh
|
||||||
|
dest: /etc/keepalived/
|
||||||
|
owner: keepalived_script
|
||||||
|
group: keepalived_script
|
||||||
|
mode: u=rx,g=rx,o=
|
||||||
|
when: keepalived_notify_script_enabled
|
||||||
|
become: true
|
||||||
|
notify: Redémarrer keepalived.service
|
||||||
|
|
||||||
|
- name: Déployer le fichier de configuration de sudoers
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: keepalived/sudoers
|
||||||
|
dest: /etc/sudoers.d/keepalived
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rw,g=r,o=r
|
||||||
|
validate: /usr/sbin/visudo -cf %s
|
||||||
|
when: "'keepalived/sudoers' is file"
|
||||||
|
become: true
|
||||||
|
@ -13,6 +13,7 @@ global_defs {
|
|||||||
smtp_connect_timeout 30
|
smtp_connect_timeout 30
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
script_user keepalived_script
|
||||||
enable_script_security
|
enable_script_security
|
||||||
max_auto_priority 50
|
max_auto_priority 50
|
||||||
}
|
}
|
||||||
@ -40,6 +41,17 @@ 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_src_ip {{ ansible_facts[keepalived_interface]['ipv4']['address'] }}
|
||||||
|
unicast_peer {
|
||||||
|
{% for peer in keepalived_peers %}
|
||||||
|
{% if peer != ansible_facts[keepalived_interface]['ipv4']['address'] %}
|
||||||
|
{{ peer }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
{% 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 +64,10 @@ vrrp_instance VIP_{{ keepalived_uid }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if keepalived_notify_script_enabled %}
|
||||||
|
notify /etc/keepalived/notify.sh
|
||||||
|
{% 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