add config validation

This commit is contained in:
Robert Kaussow 2017-12-24 17:36:43 +01:00
parent 058e44e57c
commit f9a73e6b23
3 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
--- ---
nginx_user: nginx nginx_user: nginx
nginx_group: nginx nginx_group: nginx
nginx_worker_processes: 1
nginx_open_ports: nginx_open_ports:
- 80 - 80
- 443 - 443

View File

@ -57,6 +57,7 @@
owner: root owner: root
group: root group: root
mode: 0640 mode: 0640
validate: /sbin/nginx -t -c %s
notify: notify:
- nginx_reload - nginx_reload
@ -67,6 +68,7 @@
owner: root owner: root
group: root group: root
mode: 0640 mode: 0640
validate: bash -c 'nginx -t -c /dev/stdin <<< "events {worker_connections 1;} http { include %s; }"'
with_items: with_items:
- header.conf - header.conf
- tls.conf - tls.conf

View File

@ -1,6 +1,6 @@
# {{ ansible_managed }} # {{ ansible_managed }}
user {{ nginx_user }} {{ nginx_group }}; user {{ nginx_user }} {{ nginx_group }};
worker_processes 1; worker_processes {{ nginx_worker_processes }};
error_log /var/log/nginx/error.log; error_log /var/log/nginx/error.log;
pid /run/nginx.pid; pid /run/nginx.pid;