new vhost: nagios3 (without css)

pull/14/head
Emilien Mantel 2016-01-15 15:48:18 +01:00
parent 287d154532
commit be349ec686
3 changed files with 63 additions and 1 deletions

View File

@ -35,6 +35,7 @@ Templates
- `_backuppc`: access to [BackupPC](http://backuppc.sourceforge.net/) (be careful: you need to install [fcgiwrap](https://packages.debian.org/jessie/fcgiwrap))
- `_dokuwiki`
- `_redirect`: should not be called explicitly
- `_nagios3`: access to Nagios3 (be careful: you need to install [fcgiwrap](https://packages.debian.org/jessie/fcgiwrap))
- `_phalcon`: Phalcon PHP Framework
- `_php`: PHP base template. Can work with many frameworks/tools
- `_php_index`: Same as above. But you can only run index.php

View File

@ -0,0 +1,48 @@
{% extends "_base.j2" %}
{% block root %}
root /usr/share/nagios3/htdocs;
{% endblock %}
{% block template_try_files %}
try_files $uri $uri/;
{% endblock %}
{% block template_index %}
index index.php index.html;
{% endblock %}
{% block template_local_content %}
location ~ /\.ht {
deny all;
}
location /stylesheets {
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;
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;
}
location ~ \.php$ {
fastcgi_pass php;
fastcgi_index index.php;
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
include fastcgi_params;
{% else %}
include fastcgi.conf;
{% endif %}
}
{% endblock %}

View File

@ -143,6 +143,9 @@
- name: 'backuppc.local'
template: '_backuppc'
htpasswd: 'hello'
- name: 'nagios3.local'
template: '_nagios3'
htpasswd: 'hello'
- name: 'test-ssl.local'
proto: ['http', 'https']
template: '_base'
@ -154,7 +157,10 @@
roles:
- ../../
post_tasks:
- apt: pkg=backuppc state=present
- apt: pkg={{ item }} state=present
with_items:
- nagios3
- backuppc
- service: name=backuppc state=started
- name: -- Add PHP file --
copy: dest="{{ nginx_root }}/{{ item }}/public/index.php" content="<?php phpinfo();"
@ -209,6 +215,13 @@
changed_when: false
register: authbpc
failed_when: authbpc.stdout.find('BackupPC Server Status') == -1
- name: -- VERIFY NAGIOS3 PHP --
command: "curl -u hanx:qwerty -H 'Host: nagios3.local' http://127.0.0.1/side.php"
changed_when: false
failed_when: authok.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"
changed_when: false
- name: -- VERIFY SSL --
command: "curl --insecure -H 'Host: {{ item }}' https://127.0.0.1/"
changed_when: false