Skip to content

Commit

Permalink
support icinga2_objects var outside of hostvars (#106)
Browse files Browse the repository at this point in the history
* support vars outside of hostvars too

* remove unsupported python version
  • Loading branch information
mkayontour authored Aug 23, 2022
1 parent 4e54a97 commit 98392d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
# max-parallel: 4
matrix:
distro: [centos7, centos8, debian10]
python: ['3.6', '3.8']
python: ['3.8','3.10']
ansible: ['2.9.10']
scenario: [default]

Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
# max-parallel: 4
matrix:
distro: [centos7, centos8, debian10]
python: ['3.6', '3.8', '3.9']
python: ['3.8', '3.9', '3.10']
ansible: ['2.10.7', '2.11.8']
scenario: [default]

Expand Down
2 changes: 1 addition & 1 deletion molecule/default/host_vars/icinga-default.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
icinga2_custom_config:
- name: icinga2_command
path: zones.d/main/commands/custom_commands.conf
path: zones.d/main/commands/custom_commands.conf


icinga2_objects:
Expand Down
5 changes: 5 additions & 0 deletions roles/icinga2/tasks/objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
with_items: "{{ groups['all'] }}"
when: hostvars[item]['icinga2_objects'][ansible_fqdn] is defined

- name: collect all config objects in play vars
set_fact:
tmp_objects: "{{ tmp_objects| default([]) + vars['icinga2_objects'][ansible_fqdn] }}"
when: vars['icinga2_objects'][ansible_fqdn] is defined

- icinga2_object:
args: "{{ item }}"
with_items: "{{ tmp_objects }}"
Expand Down

0 comments on commit 98392d6

Please sign in to comment.