46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
---
|
|
# tasks file for keepalived
|
|
|
|
- name: Installer le paquet
|
|
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
|
|
|
|
- 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
|