Auto-restart nagios when its config changes
This commit is contained in:
parent
e3c5c00272
commit
be7d1a24d6
@ -7,6 +7,7 @@
|
|||||||
tags: [ nagios ]
|
tags: [ nagios ]
|
||||||
- name: template out config for 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
|
template: src=nagios-hosts.cfg.j2 dest=/data/nagios/etc/objects/ansible.cfg owner=root group=root mode=0644
|
||||||
|
register: config
|
||||||
tags: [ nagios, template ]
|
tags: [ nagios, template ]
|
||||||
- name: assure config file is loaded
|
- name: assure config file is loaded
|
||||||
lineinfile: path=/data/nagios/etc/nagios.cfg line='cfg_file=/opt/nagios/etc/objects/ansible.cfg'
|
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/plugins:/opt/Custom-Nagios-Plugins
|
||||||
- /data/nagios/ssmtp.conf:/etc/ssmtp/ssmtp.conf
|
- /data/nagios/ssmtp.conf:/etc/ssmtp/ssmtp.conf
|
||||||
tags: [ docker, nagios ]
|
tags: [ docker, nagios ]
|
||||||
|
- name: restart nagios
|
||||||
|
docker_container: name=nagios state=started restart=yes
|
||||||
|
when: config and config is changed
|
||||||
|
tags: [ docker, nagios ]
|
||||||
|
Loading…
Reference in New Issue
Block a user