nginx: fix multiple fails in check mode
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2670|11|2659|11|:-1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/443//ansiblelint">Evolix » ansible-roles » unstable #443</a>
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
William Hirigoyen 2024-01-03 11:29:20 +01:00
parent 41897f4c62
commit 0a590b6679
7 changed files with 15 additions and 1 deletions

View file

@ -80,6 +80,8 @@ The **patch** part changes is incremented if multiple releases happen the same m
* webapps/nextcloud: fix Add Ceph volume to fstab : missing UUID= in src
* webapps/nextcloud: fix misplaced gid attribute
* webapps/nextcloud: fix missing gid
* nginx: fix mistake between "check_mode: no" and "when: not ansible_check_mode" (fail in check mode)
* nginx: add "when: not ansible_check_mode" in various tasks to prevent fail in check mode
### Removed

View file

@ -3,13 +3,16 @@
ansible.builtin.service:
name: nginx
state: restarted
when: not ansible_check_mode
- name: reload nginx
ansible.builtin.service:
name: nginx
state: reloaded
when: not ansible_check_mode
- name: restart munin
ansible.builtin.service:
name: munin-node
state: restarted
when: not ansible_check_mode

View file

@ -6,6 +6,7 @@
line: "allow {{ item }};"
state: present
loop: "{{ nginx_ipaddr_whitelist_present }}"
when: not ansible_check_mode
notify: reload nginx
tags:
- nginx
@ -17,6 +18,7 @@
line: "allow {{ item }};"
state: absent
loop: "{{ nginx_ipaddr_whitelist_absent }}"
when: not ansible_check_mode
notify: reload nginx
tags:
- nginx

View file

@ -24,6 +24,7 @@
line: '\1worker_connections 1024;'
insertafter: 'events \{'
backrefs: yes
when: not ansible_check_mode
tags:
- nginx
@ -34,6 +35,7 @@
line: '\1use epoll;'
insertafter: 'events \{'
backrefs: yes
when: not ansible_check_mode
tags:
- nginx
@ -145,6 +147,7 @@
name: nginx
enabled: yes
state: started
when: not ansible_check_mode
tags:
- nginx

View file

@ -37,3 +37,4 @@
daemon_reload: yes
enabled: yes
state: started
when: not ansible_check_mode

View file

@ -26,13 +26,15 @@
ansible.builtin.command:
cmd: "tail -n 1 {{ nginx_serverstatus_suffix_file }}"
changed_when: False
check_mode: no
when: not ansible_check_mode
register: new_nginx_serverstatus_suffix
- name: overwrite nginx_serverstatus_suffix
ansible.builtin.set_fact:
nginx_serverstatus_suffix: "{{ new_nginx_serverstatus_suffix.stdout }}"
when: not ansible_check_mode
- ansible.builtin.debug:
var: nginx_serverstatus_suffix
verbosity: 1
when: not ansible_check_mode

View file

@ -17,4 +17,5 @@
dest: /etc/nginx/sites-available/evolinux-default.conf
regexp: 'location /server-status-? {'
replace: 'location /server-status-{{ nginx_serverstatus_suffix }} {'
when: not ansible_check_mode
notify: reload nginx