ansible-roles/keepalived/tasks/main.yml

62 lines
1.2 KiB
YAML
Raw Normal View History

---
2021-02-11 17:32:01 +01:00
- name: install Keepalived service
apt:
2021-02-16 11:41:05 +01:00
pkg: keepalived
state: present
tags:
- keepalived
- name: Add notify.sh script for NRPE check
file:
src: notify.sh
dest: /etc/keepalived/notify.sh
mode: "0755"
owner: root
group: root
force: yes
notify: restart keepalived
tags:
- keepalived
- nrpe
- name: check_keepalived is installed
file:
src: check_keepalived
dest: /usr/local/lib/nagios/plugins/check_keepalived
mode: "0755"
owner: root
group: root
force: yes
2022-03-02 16:21:39 +01:00
tags:
2021-02-16 11:41:05 +01:00
- keepalived
- nrpe
- name: Use check_keepalived for NRPE
lineinfile:
dest: /etc/nagios/nrpe.d/evolix.cfg
regexp: 'command\[check_keepalived\]'
replace: 'command[check_keepalived]=/usr/local/lib/nagios/plugins/check_keepalived'
notify: restart nagios-nrpe-server
tags:
- keepalived
- nrpe
2021-02-11 17:32:01 +01:00
- name: generate Keepalived configuration
template:
2021-02-16 11:41:05 +01:00
src: keepalived.conf.j2
dest: /etc/keepalived/keepalived.conf
2022-06-08 15:38:21 +02:00
mode: "0644"
2021-02-11 17:32:01 +01:00
notify: restart keepalived
2021-02-16 11:41:05 +01:00
tags:
- keepalived
2021-02-11 17:32:01 +01:00
- name: enable and restart Keepalived service
systemd:
2021-02-16 11:41:05 +01:00
name: keepalived
daemon_reload: yes
state: started
enabled: yes
tags:
- keepalived