Skip to content

Commit fe55b5c

Browse files
committed
Add labels to loops
Add some labels to loops to not print secrets when running Ansible without verbosity. Some labels now also remove clutter from the output.
1 parent 6da5d1c commit fe55b5c

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

roles/icinga2/tasks/configure.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
set_fact:
44
icinga2_dict_features: "{{ icinga2_dict_features|default({}) | combine({ item.name: item }) }}"
55
with_items: "{{ icinga2_features }}"
6+
loop_control:
7+
label: "{{ item.name }}"
68

79
- name: main config file {{ icinga2_config_path + '/icinga2.conf' }}
810
template:
@@ -60,6 +62,8 @@
6062
state: absent
6163
dest: "{{ item.path }}"
6264
loop: "{{ result_frag.files }}"
65+
loop_control:
66+
label: "{{ item.path }}"
6367
when:
6468
- item.path not in icinga2_local_objects
6569
- item.path not in _icinga2_custom_conf_paths
@@ -94,6 +98,8 @@
9498
group: "{{ icinga2_group }}"
9599
mode: 0644
96100
loop: "{{ result.files }}"
101+
loop_control:
102+
label: "{{ item.path }}"
97103
notify: check-and-reload-icinga2-service
98104

99105
- name: enable features
@@ -102,6 +108,8 @@
102108
path: "{{ '/etc/icinga2/features-enabled/' + icinga2_feature_realname[item.name]|default(item.name) + '.conf' }}"
103109
src: "{{ '../features-available/' + icinga2_feature_realname[item.name]|default(item.name) + '.conf' if (item.state is undefined or item.state != 'absent') else omit }}"
104110
loop: "{{ icinga2_features }}"
111+
loop_control:
112+
label: "{{ item.name }}"
105113
notify: check-and-reload-icinga2-service
106114

107115
- name: remove empty config files

roles/icinga2/tasks/features.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
set_fact:
1313
features_enabled: "{{ features_enabled|default([]) + [ icinga2_feature_realname[item.path| basename| splitext| first]| default(item.path| basename| splitext| first) ] }}"
1414
loop: "{{ icinga2_collected_features.files }}"
15+
loop_control:
16+
label: "{{ item.path }}"
1517
when: icinga2_purge_features
1618

1719
- name: purge features
@@ -25,3 +27,5 @@
2527
- name: configure features
2628
include_tasks: "features/{{ item.name }}.yml"
2729
loop: "{{ icinga2_features }}"
30+
loop_control:
31+
label: "{{ item.name }}"

roles/icinga2/tasks/features/api.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
loop: "{{ result.results }}"
5353
loop_control:
5454
loop_var: idx
55+
label: "Add '{{ idx.path }}' to local objects"
5556

5657
- name: feature api Zone objects
5758
icinga2_object:
@@ -67,6 +68,7 @@
6768
loop: "{{ result.results }}"
6869
loop_control:
6970
loop_var: idx
71+
label: "Add '{{ idx.path }}' to local objects"
7072

7173
- name: create new CA
7274
block:

roles/icinga2/tasks/objects.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@
2626
- icinga2_object:
2727
args: "{{ item }}"
2828
with_items: "{{ tmp_objects }}"
29+
loop_control:
30+
label: "{{ item.type }} '{{ item.name }}'"
2931
when: tmp_objects is defined
3032
register: result
3133

3234
- set_fact:
3335
icinga2_local_objects: "{{ icinga2_local_objects|default([]) + [item.dest] }}"
3436
with_items: "{{ result.results }}"
37+
loop_control:
38+
label: "{{ item.dest }}"
3539
when: result.results is defined
3640

3741
- name: prepare custom config

roles/icingaweb2/tasks/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
- name: Check each icingaweb2_modules key against known modules
1616
when: not icingaweb2_ignore_unknown_modules
1717
loop: "{{ icingaweb2_modules | default({}) | dict2items }}"
18+
loop_control:
19+
label: "{{ item.key }}"
1820
ansible.builtin.assert:
1921
that:
2022
- item.key in icingaweb2_module_packages.keys()
@@ -24,6 +26,8 @@
2426
ansible.builtin.set_fact:
2527
icingaweb2_packages: "{{ icingaweb2_packages + [ icingaweb2_module_packages[item.key] ] }}"
2628
loop: "{{ icingaweb2_modules | dict2items }}"
29+
loop_control:
30+
label: "{{ item.key }}"
2731
when: icingaweb2_modules is defined and icingaweb2_module_packages[item.key] is defined and item.value.enabled | bool == true and item.value.source == "package"
2832
no_log: true
2933

@@ -66,6 +70,8 @@
6670
- icingaweb2_modules is defined
6771
- item.key in icingaweb2_module_packages.keys()
6872
loop: "{{ icingaweb2_modules | dict2items }}"
73+
loop_control:
74+
label: "{{ item.key }}"
6975

7076
# Many daemons fail before e.g. the resource is set up or the schema hasn't been migrated. This is a workaround.
7177
- name: Manage enabled module daemons
@@ -74,3 +80,5 @@
7480
state: restarted
7581
when: icingaweb2_modules is defined and item.value.enabled|default(false)|bool == true and item.key in ['vspheredb', 'x509']
7682
loop: "{{ icingaweb2_modules | dict2items }}"
83+
loop_control:
84+
label: "{{ item.key }}"

roles/icingaweb2/tasks/manage_icingaweb_db.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@
2424
loop: "{{ icingaweb2_users }}"
2525
loop_control:
2626
loop_var: _current_user
27+
label: "{{ _current_user.username }}"
2728
when: icingaweb2_users | length > 0

0 commit comments

Comments
 (0)