Compare commits
2 Commits
c342aa9438
...
d63e0ede09
Author | SHA1 | Date | |
---|---|---|---|
d63e0ede09 | |||
f48693ca5e |
@ -1,7 +1,14 @@
|
|||||||
---
|
---
|
||||||
# handlers file for keepalived
|
# handlers file for keepalived
|
||||||
|
|
||||||
- name: Redémarrer keepalived.service
|
- name: Apply installation
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- /usr/bin/rpm-ostree
|
||||||
|
- apply-live
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Restart keepalived.service
|
||||||
become: true
|
become: true
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
state: restarted
|
state: restarted
|
||||||
|
@ -15,10 +15,3 @@ galaxy_info:
|
|||||||
dependencies:
|
dependencies:
|
||||||
- role: nftables
|
- role: nftables
|
||||||
- role: users
|
- role: users
|
||||||
vars:
|
|
||||||
users_role_keepalived:
|
|
||||||
- name: keepalived_script
|
|
||||||
comment: "Dedicated user for keepalived script"
|
|
||||||
update_password: on_create
|
|
||||||
password_lock: true
|
|
||||||
shell: /bin/bash
|
|
||||||
|
37
tasks/configuration.yml
Normal file
37
tasks/configuration.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# tasks file for keepalived
|
||||||
|
|
||||||
|
- name: Deploy 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: Restart keepalived.service
|
||||||
|
|
||||||
|
- name: Deploy sudoers configuration
|
||||||
|
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: Restart keepalived.service
|
||||||
|
|
||||||
|
- name: Deploy notify script
|
||||||
|
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: Restart keepalived.service
|
25
tasks/installation.yml
Normal file
25
tasks/installation.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
# tasks file for keepalived
|
||||||
|
|
||||||
|
- name: Install keepalived
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: keepalived
|
||||||
|
when: ansible_facts['pkg_mgr'] == "apt"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Install keepalived
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- /usr/bin/rpm-ostree
|
||||||
|
- install
|
||||||
|
- --allow-inactive
|
||||||
|
- --assumeyes
|
||||||
|
- --idempotent
|
||||||
|
- keepalived
|
||||||
|
creates: /sysroot/ostree/repo/refs/heads/rpmostree/pkg/keepalived
|
||||||
|
when: ansible_facts['pkg_mgr'] == "atomic_container"
|
||||||
|
become: true
|
||||||
|
notify: Apply installation
|
||||||
|
|
||||||
|
- name: Flush handlers
|
||||||
|
meta: flush_handlers
|
@ -1,42 +1,10 @@
|
|||||||
---
|
---
|
||||||
# tasks file for keepalived
|
# tasks file for keepalived
|
||||||
|
|
||||||
- name: Installer le paquet
|
- name: Include installation tasks
|
||||||
ansible.builtin.apt:
|
ansible.builtin.include_tasks:
|
||||||
name: keepalived
|
file: installation.yml
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Déployer la configuration
|
- name: Import configuration tasks
|
||||||
ansible.builtin.template:
|
ansible.builtin.import_tasks:
|
||||||
src: keepalived.j2
|
file: configuration.yml
|
||||||
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
|
|
||||||
|
9
vars/main.yml
Normal file
9
vars/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
# vars file for keepalived
|
||||||
|
|
||||||
|
users:
|
||||||
|
- name: keepalived_script
|
||||||
|
comment: "Dedicated user for keepalived script"
|
||||||
|
update_password: on_create
|
||||||
|
password_lock: true
|
||||||
|
shell: /bin/bash
|
Loading…
x
Reference in New Issue
Block a user