nginx(role): make loop output manageable using loop_control label

This commit is contained in:
June 2025-02-18 06:07:47 +01:00
parent 9dba002f10
commit 0e4df5b590
Signed by: june
SSH key fingerprint: SHA256:o9EAq4Y9N9K0pBQeBTqhSDrND5E7oB+60ZNx0U1yPe0
2 changed files with 8 additions and 0 deletions

View file

@ -5,3 +5,5 @@
or item.name == "redirect"
or item.name == "logging"
loop: "{{ nginx__configurations }}"
loop_control:
label: "{{ item.name }}"

View file

@ -127,12 +127,16 @@
group: root
become: true
loop: "{{ nginx__configurations }}"
loop_control:
label: "{{ item.name }}"
notify: Restart nginx
- name: Add names with suffixes from `nginx__configurations` to `nginx__config_files_to_exist` fact
ansible.builtin.set_fact:
nginx__config_files_to_exist: "{{ nginx__config_files_to_exist + [ item.name + '.conf' ] }}" # noqa: jinja[spacing]
loop: "{{ nginx__configurations }}"
loop_control:
label: "{{ item.name }}"
- name: Find configuration files to remove
ansible.builtin.find:
@ -147,4 +151,6 @@
state: absent
become: true
loop: "{{ nginx__config_files_to_remove.files }}"
loop_control:
label: "{{ item.path | ansible.builtin.basename }}"
notify: Restart nginx