Auto-restart nagios when its config changes

This commit is contained in:
Salt 2021-08-08 12:15:10 -05:00
parent e3c5c00272
commit be7d1a24d6

View File

@ -7,6 +7,7 @@
tags: [ nagios ]
- name: template out config for nagios
template: src=nagios-hosts.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
register: config
tags: [ nagios, template ]
- name: assure config file is loaded
lineinfile: path=/data/nagios/etc/nagios.cfg line='cfg_file=/opt/nagios/etc/objects/ansible.cfg'
@ -28,3 +29,7 @@
- /data/nagios/plugins:/opt/Custom-Nagios-Plugins
- /data/nagios/ssmtp.conf:/etc/ssmtp/ssmtp.conf
tags: [ docker, nagios ]
- name: restart nagios
docker_container: name=nagios state=started restart=yes
when: config and config is changed
tags: [ docker, nagios ]