2021-12-08 21:34:32 -06:00
|
|
|
# vim:ft=ansible:
|
|
|
|
- name: assure data directory for nagios
|
2022-06-16 23:45:29 -05:00
|
|
|
ansible.builtin.file: path="{{ nagios_data_dir }}" state=directory mode=0755
|
2021-12-08 21:34:32 -06:00
|
|
|
tags: [ nagios ]
|
|
|
|
- name: docker deploy nagios
|
|
|
|
docker_container:
|
|
|
|
name: nagios
|
2021-12-24 15:44:21 -06:00
|
|
|
#image: jasonrivers/nagios
|
|
|
|
image: manios/nagios:latest
|
2021-12-08 21:34:32 -06:00
|
|
|
pull: yes
|
|
|
|
restart_policy: unless-stopped
|
2024-08-10 22:59:55 -05:00
|
|
|
state: absent
|
2021-12-08 21:34:32 -06:00
|
|
|
env:
|
|
|
|
NAGIOSADMIN_USER: admin
|
|
|
|
NAGIOSADMIN_PASS: "{{ nagios_admin_pass }}"
|
|
|
|
NAGIOS_TIMEZONE: "{{ nagios_timezone }}"
|
2021-12-24 15:44:21 -06:00
|
|
|
NAGIOS_FQDN: nagios.desu.ltd
|
2021-12-08 21:34:32 -06:00
|
|
|
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/send_nsca
|
|
|
|
tags: [ docker, nagios ]
|
2021-12-24 16:47:21 -06:00
|
|
|
- name: template out scripts for nagios
|
2022-06-16 23:45:29 -05:00
|
|
|
ansible.builtin.template: src="{{ item }}" dest="{{ nagios_data_dir }}/plugins/{{ item }}" owner=root group=root mode=0755
|
2021-12-24 16:47:21 -06:00
|
|
|
with_items:
|
|
|
|
- notify-by-matrix
|
|
|
|
tags: [ nagios, template, plugins ]
|
2021-12-08 21:34:32 -06:00
|
|
|
- name: template out config for nagios
|
2022-07-23 17:26:39 -05:00
|
|
|
ansible.builtin.template: src=nagios-ansible-inventory.cfg.j2 dest="{{ nagios_data_dir }}/etc/objects/ansible.cfg" owner=100 group=101 mode=0644
|
2021-12-08 21:34:32 -06:00
|
|
|
tags: [ nagios, template ]
|
|
|
|
notify: restart nagios
|
|
|
|
- name: assure config file is loaded
|
2022-06-16 23:45:29 -05:00
|
|
|
ansible.builtin.lineinfile: path="{{ nagios_data_dir }}/etc/nagios.cfg" line='cfg_file=/opt/nagios/etc/objects/ansible.cfg'
|
2021-12-08 21:34:32 -06:00
|
|
|
tags: [ nagios, template ]
|
|
|
|
notify: restart nagios
|