Question:
When we check hostvars with:
1 2 3 |
- name: Display all variables/facts known for a host debug: var=hostvars[inventory_hostname] |
We get:
1 2 3 4 5 6 7 8 9 |
ok: [default] => { "hostvars[inventory_hostname]": { "admin_email": "admin@surfer190.com", "admin_user": "root", "ansible_all_ipv4_addresses": [ "192.168.35.19", "10.0.2.15" ],... |
How would I specify the first element of the "ansible_all_ipv4_addresses"
list?
Answer:
Use dot notation
1 2 |
"{{ ansible_all_ipv4_addresses.0 }}" |