- name: Add nagios group as 420 group: name=nagios gid=420 state=present system=yes - 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 # 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 - name: Install nagios packages yum: name={{ item }} state=installed 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 #- python-xmpp # TODO: rhel7 - perl-Mail-IMAPClient - nagios-plugins-dummy - stunnel - mod_auth_openid - name: Copy /etc/nagios config copy: src={{nagios_srcdir}}/ dest=/etc/nagios owner=nagios group=nagios tags: - nagios-config - name: Copy checkcommands.cfg template: src={{nagios_srcdir}}/checkcommands.cfg dest=/etc/nagios/checkcommands.cfg owner=nagios group=nagios - name: Copy httpd config template: src=nagios-httpd.conf dest=/etc/httpd/conf.d/nagios.conf - name: Create eventhandlers directory file: dest=/usr/lib64/nagios/plugins/eventhandlers/ state=directory - name: Copy plugins copy: src=plugins/ dest=/usr/lib64/nagios/plugins/ mode=0755 owner=root group=root # TODO: rhel7 #- name: Copy xmpp plugin config # file: src={{puppet_private}}/xmppnagios.ini dest=/etc/nagios/private/xmppnagios.ini mode=0660 owner=nagios group=nagios - name: Create log directory file: dest=/var/log/nagios state=directory group=nagios owner=nagios mode=0755 - name: Create spool directory file: dest=/var/log/nagios/spool state=directory group=nagios owner=nagios mode=0755 - name: Create checkresults directory file: dest=/var/log/nagios/spool/checkresults state=directory group=nagios owner=nagios mode=0755 - name: Copy irc-colorize.py copy: src=irc-colorize.py dest=/usr/local/bin/irc-colorize.py mode=0755 group=root owner=root - 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 - name: Nuke default nagios passwd file: dest=/etc/nagios/passwd state=absent - name: Nuke default nagios objects file: dest=/etc/nagios/objects state=absent - 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" - 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 - name: Start and autostart services service: name={{item}} state=started enabled=yes with_items: - httpd - nagios - nrpe - postfix - rsyslog