nginx: read server-status values before changing the config

This commit is contained in:
Jérémy Lecour 2020-06-14 12:49:10 +02:00 committed by Gitea
parent a381d23d1f
commit c2ae3de929
4 changed files with 26 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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