Skip to content

Commit 52baab9

Browse files
committed
Use labels for loops in template-config to reduce amount of data in output (#232)
1 parent 67edc93 commit 52baab9

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Rename all modules to use the fully qualified collection name (FQCN) per Ansible
88

99
ENHANCEMENTS:
1010

11-
Bump the Ansible `community.general` collection to `4.6.1` and `community.docker` collection to `2.2.1`.
11+
* Bump the Ansible `community.general` collection to `4.6.1` and `community.docker` collection to `2.2.1`.
12+
* Add labels to loops in `tasks/config/template-config.yml` to reduce amount of output data.
1213

1314
BUG FIXES:
1415

tasks/config/template-config.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@
4949
state: directory
5050
owner: "{{ nginx_config_main_template.user | default('nginx') }}"
5151
mode: 0755
52-
loop:
53-
"{{ nginx_config_http_template }}"
52+
loop: "{{ nginx_config_http_template }}"
53+
loop_control:
54+
label: "{{ item.config.core.client_body_temp_path.path | default('config.core.client_body_temp_path.path undefined') }}"
5455
when:
5556
- nginx_config_http_template_enable | bool
5657
- item.config.core.client_body_temp_path.path is defined
@@ -61,10 +62,9 @@
6162
state: directory
6263
owner: "{{ nginx_config_main_template.user | default('nginx') }}"
6364
mode: 0755
64-
with_subelements:
65-
- "{{ nginx_config_http_template }}"
66-
- config.proxy.cache_path
67-
- skip_missing: true
65+
loop: "{{ nginx_config_http_template | subelements('config.proxy.cache_path', skip_missing=True) }}"
66+
loop_control:
67+
label: "{{ item.1.path | default('config.proxy.cache_path.path undefined') }}"
6868
when: nginx_config_http_template_enable | bool
6969

7070
- name: Ensure NGINX HTTP directory exists
@@ -73,6 +73,8 @@
7373
state: directory
7474
mode: 0755
7575
loop: "{{ nginx_config_http_template }}"
76+
loop_control:
77+
label: "{{ item.deployment_location | default('/etc/nginx/conf.d/') | dirname }}"
7678
when: nginx_config_http_template_enable | bool
7779

7880
- name: Dynamically generate NGINX HTTP config files
@@ -82,6 +84,8 @@
8284
backup: "{{ item.backup | default(true) }}"
8385
mode: 0644
8486
loop: "{{ nginx_config_http_template }}"
87+
loop_control:
88+
label: "{{ item.deployment_location | default('/etc/nginx/conf.d/default.conf') }}"
8589
when: nginx_config_http_template_enable | bool
8690
notify: (Handler - NGINX Config) Run NGINX
8791

@@ -109,6 +113,8 @@
109113
state: directory
110114
mode: 0755
111115
loop: "{{ nginx_config_stream_template }}"
116+
loop_control:
117+
label: "{{ item.deployment_location | default('/etc/nginx/conf.d/') | dirname }}"
112118
when: nginx_config_stream_template_enable | bool
113119

114120
- name: Dynamically generate NGINX stream config files
@@ -118,5 +124,7 @@
118124
backup: true
119125
mode: 0644
120126
loop: "{{ nginx_config_stream_template }}"
127+
loop_control:
128+
label: "{{ item.deployment_location | default('/etc/nginx/conf.d/stream_default.conf') }}"
121129
notify: (Handler - NGINX Config) Run NGINX
122130
when: nginx_config_stream_template_enable | bool

0 commit comments

Comments
 (0)