role_keepalived/tasks/main.yml

43 lines
1.0 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:
src: keepalived.j2
dest: /etc/keepalived/keepalived.conf
owner: root
group: root
mode: u=rw,g=r,o=r
become: true
notify: Redémarrer keepalived.service
- name: Déployer le fichier de configuration de sudoers
ansible.builtin.template:
src: sudoers.j2
dest: /etc/sudoers.d/keepalived_script
owner: root
group: keepalived_script
mode: u=rwx,g=rx,o=
validate: /usr/sbin/visudo -cf %s
when:
- keepalived_notify_enable
- keepalived_sudoers_cmd | length > 0
become: true
notify: Redémarrer keepalived.service
- name: Déployer les scripts
ansible.builtin.template:
src: notify.bash.j2
dest: /etc/keepalived/notify.bash
owner: root
group: keepalived_script
mode: u=rwx,g=rx,o=
when: keepalived_notify_enable
become: true
notify: Redémarrer keepalived.service