34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
# vim:ft=ansible:
|
|
- name: assure data directory for nagios
|
|
file: path=/data/nagios state=directory mode=0755
|
|
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'
|
|
tags: [ nagios, template ]
|
|
- name: docker deploy nagios
|
|
docker_container:
|
|
name: nagios
|
|
image: jasonrivers/nagios
|
|
env:
|
|
NAGIOSADMIN_USER: admin
|
|
NAGIOSADMIN_PASS: "{{ secret_nagios_admin_pass }}"
|
|
NAGIOS_TIMEZONE: "America/Chicago"
|
|
networks:
|
|
- name: web
|
|
aliases: [ "nagios" ]
|
|
volumes:
|
|
- /data/nagios/etc:/opt/nagios/etc
|
|
- /data/nagios/var:/opt/nagios/var
|
|
- /data/nagios/plugins:/opt/Custom-Nagios-Plugins
|
|
- /data/nagios/nagiosgraph/var:/opt/nagiosgraph/var
|
|
- /data/nagios/nagiosgraph/etc:/opt/nagiosgraph/etc
|
|
tags: [ docker, nagios ]
|
|
- name: restart nagios
|
|
docker_container: name=nagios state=started restart=yes
|
|
when: config and config is changed
|
|
tags: [ docker, nagios ]
|