2023-04-12 12:09:46 +00:00
|
|
|
---
|
|
|
|
# tasks file for keepalived
|
|
|
|
|
2023-04-21 14:32:34 +00:00
|
|
|
- name: Installer le paquet
|
2023-04-12 12:09:46 +00:00
|
|
|
ansible.builtin.apt:
|
|
|
|
name: keepalived
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Déployer la configuration
|
|
|
|
ansible.builtin.template:
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
src: keepalived.j2
|
|
|
|
dest: /etc/keepalived/keepalived.conf
|
|
|
|
become: true
|
|
|
|
notify: Redémarrer keepalived.service
|
2023-04-21 14:32:34 +00:00
|
|
|
|
|
|
|
- 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=rX
|
|
|
|
state: directory
|
|
|
|
when: keepalived_scripts_path | length > 0
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Déployer les scripts
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: keepalived/notify_{{ item | split('_') | last }}.sh
|
|
|
|
dest: "{{ keepalived_scripts_path }}"
|
|
|
|
owner: keepalived_script
|
|
|
|
group: keepalived_script
|
|
|
|
mode: u=rx,g=rx,o=
|
|
|
|
when:
|
|
|
|
- keepalived_scripts_path | length > 0
|
|
|
|
- vars[item]
|
|
|
|
loop:
|
|
|
|
- keepalived_notify_master
|
|
|
|
- keepalived_notify_backup
|
|
|
|
- keepalived_notify_fault
|
|
|
|
- keepalived_notify_stop
|
|
|
|
become: true
|
|
|
|
notify: Redémarrer keepalived.service
|