Accessing server inventory list while deploying to clients

19 views
Skip to first unread message

ajres

unread,
Apr 15, 2015, 9:18:58 AM4/15/15
to ansible...@googlegroups.com
I have a playbook that configures multiple client machines.

Each client needs to be configured with a unique server IP address from the servers in a cluster.

The mapping from client to server is one-to-one, all the hosts are running in ec2, and the inventory is dynamic.

Is there a way that I can get the list of servers from the inventory as a list variable, and iterate over the the list as ansible configures each client?

Brian Coca

unread,
Apr 15, 2015, 10:04:38 AM4/15/15
to ansible...@googlegroups.com
the groups variable is a dictionary with the groups in which the keys
are the list of servers that are part of it, so for example
groups['all'] has a list of all the servers, you just need groups[<my
server group>]
> --
> 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 ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/fde868a8-ec24-44e8-9543-a1ceb58b9a26%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Brian Coca
Reply all
Reply to author
Forward
0 new messages