# Accessing server inventory list while deploying to clients

**URL:** <https://forum.ansible.com/t/accessing-server-inventory-list-while-deploying-to-clients/17978>\
**Category:** Ansible Project\
**Created:** [April 14, 2015, 11:53pm UTC](https://forum.ansible.com/t/accessing-server-inventory-list-while-deploying-to-clients/17978 "2015-04-14T23:53:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajres](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@ajres](https://forum.ansible.com/u/ajres)\
**Post date:** [April 14, 2015, 11:53pm UTC](https://forum.ansible.com/t/accessing-server-inventory-list-while-deploying-to-clients/17978/1 "2015-04-14T23:53:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 15, 2015, 2:04pm UTC](https://forum.ansible.com/t/accessing-server-inventory-list-while-deploying-to-clients/17978/2 "2015-04-15T14:04:35Z")

</div>

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\>]
