Hi, I'm attempting to define a variable for use with set_fact and then
refer to it again when defining another variable. Is this
possible/supported? Eg.
- name: Attempt to store host name in a temporary dictionary
set_fact:
host_name: "{{ host_prefix }}{{ (host_offset+item.0)|int }}-{{
host_suffix }}"
name_map: "{{ name_map | default({}) | merge({ item.1.id: host_name })
}}"
with_indexed_items: ec2.instances
I can see that 'host_name' gets build correctly but the dictionary just
gets 'Undefined' :( If I remove the host_name definition above name_map,
how do I then nest all of that as the argument to the dictionary entry? It
looks darn ugly for starters but I can't even figure out the string
concatenation (with an integer throw in) inside the moustaches!
Any guidance appreciated.
Jim
PS? The merge function is defined in filter_plugins/ - it's not part of
Ansible, though a standard addition.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/29b7a84d-6e3f-4146-ac7f-543a43e0f37b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.