I'm using Ansible to deploy some virtual machines and I have a list variable defining the VMs. I'm wondering if I can have one of the dict items use another as a variable within the same list element. For instance, say I have the following variable defined:
nodes:
- name: vm1
aliases:
- vm1
- vm1.local
- name: vm2
aliases:
- vm2
- vm2.local
Could I, instead, do something like this?
nodes:
- name: vm1
aliases:
- "{{ name }}"
- "{{ name }}.local"
- name: vm2
aliases:
- "{{ name }}"
- "{{ name }}.local"
I tried that and I tried using "{{ nodes.0.name }}"
.