Fix Nagios vhost and better tests

pull/14/head
Emilien Mantel 2016-01-21 15:16:21 +01:00
parent be349ec686
commit c357658c25
2 changed files with 24 additions and 13 deletions

View File

@ -5,7 +5,6 @@
{% endblock %}
{% block template_try_files %}
try_files $uri $uri/;
{% endblock %}
{% block template_index %}
@ -21,18 +20,18 @@
alias /etc/nagios3/stylesheets;
expires 60d;
}
location /nagios3 {
alias /usr/share/nagios3/htdocs;
}
{% endblock %}
{% block template_upstream_location %}
location ~ \.cgi$ {
alias /usr/lib/cgi-bin/nagios3;
gzip off;
include /etc/nginx/fastcgi_params;
location /cgi-bin/nagios3 {
root /usr/lib;
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_param SCRIPT_FILENAME /usr/lib/cgi-bin/nagios3$fastcgi_script_name;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
}

View File

@ -34,6 +34,11 @@
state: 'absent'
- name: 'hanx'
password: 'qwerty'
- name: 'nagios'
description: 'Please login to Nagios!'
users:
- name: 'nagiosadmin'
password: 'nagios'
- name: 'deleteme'
description: 'Please login!'
users: []
@ -145,7 +150,7 @@
htpasswd: 'hello'
- name: 'nagios3.local'
template: '_nagios3'
htpasswd: 'hello'
htpasswd: 'nagios'
- name: 'test-ssl.local'
proto: ['http', 'https']
template: '_base'
@ -215,13 +220,20 @@
changed_when: false
register: authbpc
failed_when: authbpc.stdout.find('BackupPC Server Status') == -1
# --------------------------------
# Nagios
# --------------------------------
- name: -- VERIFY NAGIOS3 PHP --
command: "curl -u hanx:qwerty -H 'Host: nagios3.local' http://127.0.0.1/side.php"
command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/side.php"
changed_when: false
failed_when: authok.stdout.find('Nagios Core') != -1
register: nagios_php
failed_when: nagios_php.stdout.find('Nagios Core') == -1
- name: -- VERIFY NAGIOS3 CGI --
command: "curl -u hanx:qwerty -H 'Host: nagios3.local' http://127.0.0.1/side.php"
command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/cgi-bin/nagios3/summary.cgi"
changed_when: false
register: nagios_cgi
failed_when: nagios_cgi.stdout.find('Nagios Event Summary') == -1
- name: -- VERIFY SSL --
command: "curl --insecure -H 'Host: {{ item }}' https://127.0.0.1/"
changed_when: false