diff --git a/CHANGELOG.md b/CHANGELOG.md index 5277e978..353d5280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ The **patch** part changes incrementally at each release. * packweb-apache: Don't turn on mod-evasive emails by default * haproxy: chroot and socket path are configurable * haproxy: adapt backports installed package list to distibution +* nginx: read server-status values before changing the config * redis: create sudoers file if missing * redis: new syntax for match filter * redis: raise an error is port 6379 is used in "instance" mode diff --git a/nginx/tasks/main_regular.yml b/nginx/tasks/main_regular.yml index 45e5ba47..c7989bee 100644 --- a/nginx/tasks/main_regular.yml +++ b/nginx/tasks/main_regular.yml @@ -2,6 +2,10 @@ - include: packages.yml +- include: server_status_read.yml + tags: + - nginx + # TODO: find a way to override the main configuration # without touching the main file @@ -108,7 +112,7 @@ tags: - nginx -- include: server_status.yml +- include: server_status_write.yml tags: - nginx diff --git a/nginx/tasks/server_status.yml b/nginx/tasks/server_status_read.yml similarity index 62% rename from nginx/tasks/server_status.yml rename to nginx/tasks/server_status_read.yml index 14bb3fe5..570febf9 100644 --- a/nginx/tasks/server_status.yml +++ b/nginx/tasks/server_status_read.yml @@ -34,22 +34,3 @@ - debug: var: nginx_serverstatus_suffix verbosity: 1 - -- name: replace server-status suffix in default site index - replace: - dest: /var/www/index.html - regexp: '__SERVERSTATUS_SUFFIX__' - replace: "{{ nginx_serverstatus_suffix }}" - -- name: add server-status suffix in default site index if missing - replace: - dest: /var/www/index.html - regexp: '"/nginx_status-?"' - replace: '"/nginx_status-{{ nginx_serverstatus_suffix }}"' - -- name: add server-status suffix in default VHost - replace: - dest: /etc/nginx/sites-available/evolinux-default.conf - regexp: 'location /nginx_status-? {' - replace: 'location /nginx_status-{{ nginx_serverstatus_suffix }} {' - notify: reload nginx diff --git a/nginx/tasks/server_status_write.yml b/nginx/tasks/server_status_write.yml new file mode 100644 index 00000000..e0b069db --- /dev/null +++ b/nginx/tasks/server_status_write.yml @@ -0,0 +1,20 @@ +--- + +- name: replace server-status suffix in default site index + replace: + dest: /var/www/index.html + regexp: '__SERVERSTATUS_SUFFIX__' + replace: "{{ nginx_serverstatus_suffix }}" + +- name: add server-status suffix in default site index if missing + replace: + dest: /var/www/index.html + regexp: '"/nginx_status-?"' + replace: '"/nginx_status-{{ nginx_serverstatus_suffix }}"' + +- name: add server-status suffix in default VHost + replace: + dest: /etc/nginx/sites-available/evolinux-default.conf + regexp: 'location /nginx_status-? {' + replace: 'location /nginx_status-{{ nginx_serverstatus_suffix }} {' + notify: reload nginx