Hi. I have the following inventory structure
master1 ansible_ssh_host=10.0.45.11
master2 ansible_ssh_host=10.0.45.12
master3 ansible_ssh_host=10.0.45.13
slave1 ansible_ssh_host=10.0.45.51
slave2 ansible_ssh_host=10.0.45.52
slave3 ansible_ssh_host=10.0.45.53
[master_servers]
master1
master2
master3
…
Now I need a URL that looks something like this zk://10.0.45.11:2181,10.0.45.12:2181,10.0.45.13:2181/mesos
For that reason I need a list of ansible_ssh_host variables for all servers in the group master_servers.
I ended up with this
[hostvars[groups[‘master_servers’][0]].ansible_ssh_host, hostvars[groups[‘master_servers’][1]].ansible_ssh_host, hostvars[groups[‘master_servers’][2]].ansible_ssh_host]
but this solution takes only three servers not all in the group