ansible/playbooks/tasks/web/nagios.yml

36 lines
1.1 KiB
YAML

# vim:ft=ansible:
- name: assure data directory for nagios
file: path=/data/nagios state=directory mode=0755
tags: [ nagios ]
- name: assure ssmtp.conf file for nagios
file: path=/data/nagios/ssmtp.conf state=file mode=0640
tags: [ nagios ]
- name: template out hosts for nagios
template:
src: |
{% for host in query('netbox.netbox.nb_lookup', 'devices', api_endpoint='https://netbox.desu.ltd', token=secret_netbox_api_token)%}
{{ host }}
{% endfor %}
dest: /data/nagios/etc/objects/ansible-hosts.cfg
owner: root
group: root
mode: 0644
tags: [ nagios, template ]
- name: docker deploy nagios
docker_container:
name: nagios
image: manios/nagios
env:
NAGIOSADMIN_USER: admin
NAGIOSADMIN_PASS: "{{ secret_nagios_admin_pass }}"
TZ: "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/ssmtp.conf:/etc/ssmtp/ssmtp.conf
tags: [ docker, nagios ]