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)) - `_backuppc`: access to [BackupPC](http://backuppc.sourceforge.net/) (be careful: you need to install [fcgiwrap](https://packages.debian.org/jessie/fcgiwrap))
- `_dokuwiki` - `_dokuwiki`
- `_redirect`: should not be called explicitly - `_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 - `_phalcon`: Phalcon PHP Framework
- `_php`: PHP base template. Can work with many frameworks/tools - `_php`: PHP base template. Can work with many frameworks/tools
- `_php_index`: Same as above. But you can only run index.php - `_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' - name: 'backuppc.local'
template: '_backuppc' template: '_backuppc'
htpasswd: 'hello' htpasswd: 'hello'
- name: 'nagios3.local'
template: '_nagios3'
htpasswd: 'hello'
- name: 'test-ssl.local' - name: 'test-ssl.local'
proto: ['http', 'https'] proto: ['http', 'https']
template: '_base' template: '_base'
@ -154,7 +157,10 @@
roles: roles:
- ../../ - ../../
post_tasks: post_tasks:
- apt: pkg=backuppc state=present - apt: pkg={{ item }} state=present
with_items:
- nagios3
- backuppc
- service: name=backuppc state=started - service: name=backuppc state=started
- name: -- Add PHP file -- - name: -- Add PHP file --
copy: dest="{{ nginx_root }}/{{ item }}/public/index.php" content="<?php phpinfo();" copy: dest="{{ nginx_root }}/{{ item }}/public/index.php" content="<?php phpinfo();"
@ -209,6 +215,13 @@
changed_when: false changed_when: false
register: authbpc register: authbpc
failed_when: authbpc.stdout.find('BackupPC Server Status') == -1 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 -- - name: -- VERIFY SSL --
command: "curl --insecure -H 'Host: {{ item }}' https://127.0.0.1/" command: "curl --insecure -H 'Host: {{ item }}' https://127.0.0.1/"
changed_when: false changed_when: false