Skip to content

Commit 0e257ee

Browse files
authored
Fix merging of 'icinga2_objects' (#413)
`icinga2_objects` might be a dict or a list. Merging will happen at a specific point during execution. Feature objects are now merged with `tmp_objects` to avoid problems.
1 parent fb941a6 commit 0e257ee

20 files changed

+24
-21
lines changed

roles/icinga2/tasks/configure.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
changed_when: _removed_dirs.attempts > 1
7979

8080
- name: Collect config files (icinga2_config_path)
81+
when: icinga2_config_directories is defined
8182
vars:
8283
_icinga2_config_directories: "{{
8384
(icinga2_config_directories | select('match', '^conf.d/.*')) +
@@ -96,13 +97,15 @@
9697
vars:
9798
_icinga2_sys_config_fragment_path: "{{ item | regex_replace('^' + icinga2_config_path + '(.*)$', icinga2_fragments_path + '\\1') }}"
9899
when:
100+
- icinga2_config_directories is defined
99101
- _icinga2_sys_config_fragment_path not in icinga2_local_objects
100102
- _icinga2_sys_config_fragment_path not in _icinga2_custom_conf_paths
101103
ansible.builtin.file:
102104
state: absent
103105
dest: "{{ item }}"
104106

105107
- name: Remove empty config dirs (icinga2_config_path) # noqa: command-instead-of-shell
108+
when: icinga2_config_directories is defined
106109
vars:
107110
_icinga2_config_directories: "{{
108111
(

roles/icinga2/tasks/features/api.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
- name: feature api ApiListener object
3232
ansible.builtin.set_fact:
33-
icinga2_objects: "{{ icinga2_objects + objects }}"
33+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
3434
vars:
3535
objects:
3636
- name: api
@@ -40,7 +40,7 @@
4040

4141
- name: feature api Endpoint objects
4242
ansible.builtin.set_fact:
43-
icinga2_objects: "{{ icinga2_objects + objects }}"
43+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
4444
vars:
4545
objects:
4646
- type: Endpoint
@@ -52,7 +52,7 @@
5252

5353
- name: feature api Zone objects
5454
ansible.builtin.set_fact:
55-
icinga2_objects: "{{ icinga2_objects + objects }}"
55+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
5656
vars:
5757
objects:
5858
- type: Zone

roles/icinga2/tasks/features/checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature checker CheckerComponent object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: checker

roles/icinga2/tasks/features/command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature command ExternalCommandListener object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: command

roles/icinga2/tasks/features/compatlog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: Feature compatlog CompatLogger object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: compatlog

roles/icinga2/tasks/features/debuglog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature debuglog FileLogger object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: debug-file

roles/icinga2/tasks/features/elasticsearch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature elasticsearch ElasticsearchWriter object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: elasticsearch

roles/icinga2/tasks/features/gelf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature influxdb GelfWriter object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: gelf

roles/icinga2/tasks/features/graphite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature graphite GraphiteWriter object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: graphite

roles/icinga2/tasks/features/icingadb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- name: feature icingadb IcingaDB object
44
ansible.builtin.set_fact:
5-
icinga2_objects: "{{ icinga2_objects + objects }}"
5+
tmp_objects: "{{ tmp_objects | default([]) + objects }}"
66
vars:
77
objects:
88
- name: icingadb

0 commit comments

Comments
 (0)