42 lines
1.6 KiB
YAML
42 lines
1.6 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
|
|
image: manios/nagios:latest
|
|
pull: yes
|
|
restart_policy: unless-stopped
|
|
state: started
|
|
env:
|
|
NAGIOSADMIN_USER: admin
|
|
NAGIOSADMIN_PASS: "{{ nagios_admin_pass }}"
|
|
NAGIOS_TIMEZONE: "{{ nagios_timezone }}"
|
|
NAGIOS_FQDN: nagios.desu.ltd
|
|
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 ]
|
|
- name: template out scripts for nagios
|
|
template: src="{{ item }}" dest="{{ nagios_data_dir }}/plugins/{{ item }}" owner=root group=root mode=0755
|
|
with_items:
|
|
- notify-by-matrix
|
|
tags: [ nagios, template, plugins ]
|
|
- name: template out config for nagios
|
|
template: src=nagios-ansible-inventory.cfg.j2 dest="{{ nagios_data_dir }}/etc/objects/ansible.cfg" owner=101 group=100 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
|