Nagios OK on FreeBSD

pull/14/head
Emilien Mantel 2016-03-05 18:34:04 +01:00
parent 729b621ccb
commit cdc152afbe
5 changed files with 48 additions and 5 deletions

View File

@ -1,7 +1,7 @@
{% extends "_base.j2" %}
{% block root %}
root /usr/share/nagios3/htdocs;
root {{ nginx_nagios_root }};
{% endblock %}
{% block template_try_files %}
@ -17,21 +17,27 @@
}
location /stylesheets {
alias /etc/nagios3/stylesheets;
{% if nginx_nagios_stylesheets is defined %}
alias {{ nginx_nagios_stylesheets }};
{% endif %}
expires 60d;
}
{% endblock %}
{% block template_upstream_location %}
{% if ansible_distribution == 'Debian' %}
location /cgi-bin/nagios3 {
root /usr/lib;
{% elif ansible_distribution == 'FreeBSD' %}
location /cgi-bin {
{% endif %}
try_files $uri =404;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_pass unix:{{ nginx_fcgiwrap_sock }};
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}

View File

@ -1,2 +1,31 @@
---
- name: APT | Install web apps
pkgng: pkg={{ item }} state=present
with_items:
- nagios
- backuppc
- name: COMMAND | Activate backuppc config
command: >
cp /usr/local/etc/backuppc/config.pl.sample /usr/local/etc/backuppc/config.pl
creates=/usr/local/etc/backuppc/config.pl
- name: FILE | Fix backuppc permissions
file: >
path=/usr/local/etc/backuppc/config.pl
owner=backuppc
group=backuppc
- name: FILE | Fix fcgiwrap permission
file: >
path={{ nginx_fcgiwrap_sock }}
mode=0640
owner={{ nginx_user }}
group={{ nginx_user }}
#
# We don't manage BackupPC on FreeBSD... too dirty. :/
#
#- name: SERVICE | Ensure backuppc is started
# service: name=backuppc state=started enabled=yes

View File

@ -262,6 +262,7 @@
changed_when: false
register: authbpc
failed_when: authbpc.stdout.find('BackupPC Server Status') == -1
when: ansible_distribution != 'FreeBSD'
# --------------------------------
# Nagios
@ -272,7 +273,7 @@
register: nagios_php
failed_when: nagios_php.stdout.find('Nagios Core') == -1
- name: -- VERIFY NAGIOS3 CGI --
command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/cgi-bin/nagios3/summary.cgi"
command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/cgi-bin{% if ansible_distribution == 'Debian' %}/nagios3{% endif %}/summary.cgi"
changed_when: false
register: nagios_cgi
failed_when: nagios_cgi.stdout.find('Nagios Event Summary') == -1

View File

@ -1,3 +1,8 @@
nginx_events_use: 'epoll'
nginx_pid: '/run/nginx.pid'
nginx_etc_dir: '/etc/nginx'
# Specific vhosts
nginx_nagios_root: '/usr/share/nagios3/htdocs'
nginx_nagios_stylesheets: '/etc/nagios3/stylesheets'
nginx_fcgiwrap_sock: '/var/run/fcgiwrap.socket'

View File

@ -2,4 +2,6 @@ nginx_events_use: 'kqueue'
nginx_pid: '/var/run/nginx.pid'
nginx_etc_dir: '/usr/local/etc/nginx'
# TODO: it's a dirty to force variable here!
# Specific vhosts
nginx_nagios_root: '/usr/local/www/nagios'
nginx_fcgiwrap_sock: '/var/run/fcgiwrap/fcgiwrap.sock'