You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But we get the following error when running our deploy: fatal: [icingamaster.example.com]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ tmp_objects| default([]) + vars['icinga2_objects'][icinga2_config_host] }}): can only concatenate list (not \"AnsibleUnicode\") to list"}
Editing the roles/icinga2/tasks/objects.yml file to use the lookup plugin instead resolves the issue:
- name: collect all config objects in play vars
set_fact:
tmp_objects: "{{ tmp_objects| default([]) + lookup('list', icinga2_objects[icinga2_config_host]) }}"
when: vars['icinga2_objects'][icinga2_config_host] is defined
Tested it both with variables and declaring the list directly and both works as intended.
This also has an added benefit of allowing variables to be used within an object in the list.
icinga2_objects:
icingamaster.example.com:
- name: "icingac1.example.com"
type: Host
file: zones.d/main/hosts/hosts.conf
imports:
- generic-host
groups:
- linux-servers
vars:
test: "{{ansible_fqdn}}" # <------ Won't work in current implementation but would resolve correctly if using lookup plugin
disks["disk /"]:
disk_partitions: "/"
The text was updated successfully, but these errors were encountered:
We've noticed an issue with assigning an existing list variable to the icinga2_objects property.
In our script we're running a task to generate a list of agent hosts for our master.
Later we try to reference this variable in our masters icinga2_objects variable:
But we get the following error when running our deploy:
fatal: [icingamaster.example.com]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ tmp_objects| default([]) + vars['icinga2_objects'][icinga2_config_host] }}): can only concatenate list (not \"AnsibleUnicode\") to list"}
Editing the
roles/icinga2/tasks/objects.yml
file to use the lookup plugin instead resolves the issue:Tested it both with variables and declaring the list directly and both works as intended.
This also has an added benefit of allowing variables to be used within an object in the list.
The text was updated successfully, but these errors were encountered: