feat: Create role

This commit is contained in:
2023-04-12 14:09:46 +02:00
committed by pulsar89.5
parent d09e5403e9
commit 00e8f234e4
11 changed files with 400 additions and 4 deletions

37
tasks/configuration.yml Normal file
View 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

7
tasks/installation.yml Normal file
View File

@@ -0,0 +1,7 @@
---
# tasks file for keepalived
- name: Install keepalived
ansible.builtin.apt:
name: keepalived
become: true

10
tasks/main.yml Normal file
View File

@@ -0,0 +1,10 @@
---
# tasks file for keepalived
- name: Import installation tasks
ansible.builtin.import_tasks:
file: installation.yml
- name: Import configuration tasks
ansible.builtin.import_tasks:
file: configuration.yml