Files
fedora-infra_ansible/roles/nagios/server/tasks/main.yml
Patrick Uiterwijk 5b6f50f69d Install the right plugin for nagios gssapi
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
2016-11-24 19:36:59 +00:00

151 lines
4.0 KiB
YAML

- name: Add nagios group as 420
group: name=nagios gid=420 state=present system=yes
tags:
- nagios/server
- name: Add nagios user as 420
user: name=nagios uid=420 state=present home=/var/spool/nagios comment="Nagios Monitoring User" createhome=yes system=yes shell=/bin/bash
tags:
- nagios/server
# Add the apache user to the nagios group so that it has permissions
# to do stuff in /var/spool/nagios/*
- name: Add apache to nagios group
user: name=apache append=yes groups=nagios
tags:
- nagios/server
- name: Install nagios packages
yum: name={{ item }} state=present
with_items:
- php
- nagios-plugins-http
- nagios-plugins-dns
- nagios-plugins-dig
- nagios-plugins-ssh
- nagios-plugins-nagios
- nagios-plugins-nrpe
- nagios-plugins-tcp
- nagios-plugins-pgsql
- nagios-plugins-smtp
- nagios.x86_64
- nagios-plugins
- perl-Mail-IMAPClient
- nagios-plugins-dummy
- stunnel
- mod_auth_gssapi
tags:
- nagios/server
- name: Copy /etc/nagios config
synchronize: src={{nagios_srcdir}}/ dest=/etc/nagios/
tags:
- nagios-config
- nagios/server
notify: restart nagios
- name: copy over nagios/checkcommands.cfg template
template: src={{nagios_srcdir}}/checkcommands.cfg dest=/etc/nagios/checkcommands.cfg
tags:
- nagios-config
- nagios/server
notify: restart nagios
- name: Copy httpd config
template: src=nagios-httpd.conf dest=/etc/httpd/conf.d/nagios.conf
tags:
- nagios/server
- name: Create eventhandlers directory
file: dest=/usr/lib64/nagios/plugins/eventhandlers/ state=directory
tags:
- nagios/server
- name: Copy plugins
copy: src=plugins/ dest=/usr/lib64/nagios/plugins/ mode=0755 owner=root group=root
tags:
- nagios/server
- name: Create log directory
file: dest=/var/log/nagios state=directory group=nagios owner=nagios mode=0755
tags:
- nagios/server
- name: Create spool directory
file: dest=/var/log/nagios/spool state=directory group=nagios owner=nagios mode=0755
tags:
- nagios/server
- name: Create checkresults directory
file: dest=/var/log/nagios/spool/checkresults state=directory group=nagios owner=nagios mode=0755
tags:
- nagios/server
- name: Copy irc-colorize.py
copy: src=irc-colorize.py dest=/usr/local/bin/irc-colorize.py mode=0755 group=root owner=root
tags:
- nagios/server
- name: Copy specialized nrpe.cfg for nagios server
copy: src=nrpe.cfg dest=/etc/nagios/nrpe.cfg mode=0644 group=root owner=root
notify:
- restart nrpe
tags:
- config
- nagios/server
- name: Copy check_nagios_notifications.py
copy: src=check_nagios_notifications.py dest=/usr/local/bin/check_nagios_notifications.py mode=0755 group=root owner=root
tags:
- nagios/server
- name: Nuke default nagios passwd
file: dest=/etc/nagios/passwd state=absent
tags:
- nagios/server
- name: Nuke default nagios objects
file: dest=/etc/nagios/objects state=absent
tags:
- nagios/server
- name: Install check_nagios_notifications cron
cron: name="check_nagios_notifications" minute=0 hour=0 weekday=1 user=nagios job="/usr/local/bin/check_nagios_notifications.py"
tags:
- nagios/server
- name: Override config.inc.php for the given environment
template: src=config.inc.php dest=/usr/share/nagios/html/config.inc.php mode=0640 owner=root group=apache
tags:
- nagios/server
# Handle selinux annoyances - roughly copied from fedmsg role
- name: Ensure a directory exists for our custom selinux module
file: dest=/usr/local/share/nagios-policy state=directory
tags:
- nagios/server
- name: Copy over our custom selinux module
copy: src=selinux/nagios_hostname.pp dest=/usr/local/share/nagios-policy/nagios_hostname.pp
register: selinux_module
tags:
- nagios/server
- name: Install our custom selinux module
command: semodule -i /usr/local/share/nagios-policy/nagios_hostname.pp
when: selinux_module|changed
tags:
- nagios/server
- name: Start and autostart services
service: name={{item}} state=started enabled=yes
with_items:
- httpd
- nagios
- nrpe
- postfix
- rsyslog
tags:
- nagios/server