ansible/roles/nagios/tasks/main.yml
Salt fcffd834a0 Move Nagios into its own role
It was getting way too big
2021-12-08 21:34:32 -06:00

36 lines
1.3 KiB
YAML

# vim:ft=ansible:
- name: assure data directory for nagios
file: path="{{ nagios_data_dir }}" state=directory mode=0755
tags: [ nagios ]
- name: docker deploy nagios
docker_container:
name: nagios
image: jasonrivers/nagios
pull: yes
restart_policy: unless-stopped
state: started
env:
NAGIOSADMIN_USER: admin
NAGIOSADMIN_PASS: "{{ nagios_admin_pass }}"
NAGIOS_TIMEZONE: "{{ nagios_timezone }}"
networks:
- name: web
aliases: [ "nagios" ]
volumes:
- "{{ nagios_data_dir }}/etc:/opt/nagios/etc"
- "{{ nagios_data_dir }}/var:/opt/nagios/var"
- "{{ nagios_data_dir }}/plugins:/opt/Custom-Nagios-Plugins"
- "{{ nagios_data_dir }}/nagiosgraph/var:/opt/nagiosgraph/var"
- "{{ nagios_data_dir }}/nagiosgraph/etc:/opt/nagiosgraph/etc"
- /dev/null:/opt/nagios/bin/nsca
- /dev/null:/opt/nagios/bin/send_nsca
tags: [ docker, nagios ]
- name: template out config for nagios
template: src=nagios-ansible.cfg.j2 dest="{{ nagios_data_dir }}/etc/objects/ansible.cfg" owner=root group=root mode=0644
tags: [ nagios, template ]
notify: restart nagios
- name: assure config file is loaded
lineinfile: path="{{ nagios_data_dir }}/etc/nagios.cfg" line='cfg_file=/opt/nagios/etc/objects/ansible.cfg'
tags: [ nagios, template ]
notify: restart nagios