From be349ec6861bc6a6ce577cb9eaca3891371d4ce7 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Fri, 15 Jan 2016 15:48:18 +0100 Subject: [PATCH] new vhost: nagios3 (without css) --- doc/vhost.md | 1 + .../etc/nginx/sites-available/_nagios3.j2 | 48 +++++++++++++++++++ tests/test.yml | 15 +++++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 templates/etc/nginx/sites-available/_nagios3.j2 diff --git a/doc/vhost.md b/doc/vhost.md index 208bde2..cf5e281 100644 --- a/doc/vhost.md +++ b/doc/vhost.md @@ -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 diff --git a/templates/etc/nginx/sites-available/_nagios3.j2 b/templates/etc/nginx/sites-available/_nagios3.j2 new file mode 100644 index 0000000..b9ea7d0 --- /dev/null +++ b/templates/etc/nginx/sites-available/_nagios3.j2 @@ -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 %} diff --git a/tests/test.yml b/tests/test.yml index 8587574..c6cd0f9 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -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="