On 19. juli 2016 23:28, Jon Murillo wrote:
How can I use this *when* function to work with the hosts in my inventory file? I had *when: inventory_hostname == play_hosts[0]* but I notice that it only selects a random server. I want it to select all of the servers. Using a * doesn't work..
I don't understand why you want to do this, inventory_hostname will always be in play_hosts, so it will always be true.
Maybe you are looking for "with_items: play_hosts"? To check if something is in a list the syntax is when: <variable> in <list> -- Kai Stian Olstad -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/578FA450.8060303%40olstad.com. For more options, visit https://groups.google.com/d/optout.
