I can’t figure out how to create the correct pattern. Currently I am about to get a list of three zookeeper boxes from the pattern tag_zookeeper:&tag_env_test.What I need is to get the first (really just any 1) one that results from that list.
Is there any way to do that?
Cheers,
Edgardo
tag_zookeeper:&tag_env_test[0]
That doesn’t work. That gets the first in the tag_env_test group and intersects with the lst of tag_zookeeper.
(lookup(‘inventory_hostnames’, ‘tag_zookeeper:&tag_env_test’)|list)[0]
That didn’t seem to work in a playbook setting hosts
hosts:(lookup(‘inventory_hostnames’, ‘tag_zookeeper:&tag_env_test’)|list)[0]
any suggestions?
I should have been more explicit:
hosts: “{{(lookup(‘inventory_hostnames’, ‘tag_zookeeper:&tag_env_test’)|list)[0]}}”