I have an inventory in which I define some vars like the server ip:
all:
children:
my_servers:
children:
data:
hosts:
data01.mydomain:
ansible_host: 10.0.0.1
es_name: "data01"
data02.mydomain:
ansible_host: 10.0.0.2
es_name: "data02"
I know that to access the hostnames I can use something like "{{ groups['data'] }}" and this will iterate over the hostnames.
What I would like to do is to iterate over the var "ansible_host" in each hostname (to open rules on a firewall). I can have the value of one with "{{ hostvars['data01']['ansible_host'] }}" but I can't find the way to iterate over all hosts on the inventory.