# Selecting Host in Multiple Groups

**URL:** <https://forum.ansible.com/t/selecting-host-in-multiple-groups/14745>\
**Category:** Ansible Project\
**Created:** [March 10, 2014, 7:28pm UTC](https://forum.ansible.com/t/selecting-host-in-multiple-groups/14745 "2014-03-10T19:28:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Goodhouse](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@James\_Goodhouse](https://forum.ansible.com/u/James_Goodhouse)\
**Post date:** [March 10, 2014, 7:28pm UTC](https://forum.ansible.com/t/selecting-host-in-multiple-groups/14745/1 "2014-03-10T19:28:24Z")

</div>

Hey All,

How would one go about targeting hosts based on being them being in multiple groups? For example, I have a staging inventory file with a Vagrant group and a Japan group. I want to target a vagrant server that is also in the Japan group, but don’t want the Japan hosts that aren’t in the Vagrant group.

I hope that was clear :-/

Thanks in advance!

- James

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [March 10, 2014, 7:38pm UTC](https://forum.ansible.com/t/selecting-host-in-multiple-groups/14745/2 "2014-03-10T19:38:09Z")

</div>

​Sounds like "Vagrant:&Japan" ?​

---

<div class="post-metadata">

**Author:** ![James\_Goodhouse](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@James\_Goodhouse](https://forum.ansible.com/u/James_Goodhouse)\
**Post date:** [March 10, 2014, 8:04pm UTC](https://forum.ansible.com/t/selecting-host-in-multiple-groups/14745/3 "2014-03-10T20:04:16Z")

</div>

That would be a group in the inventory file, correct? Is there a way to do it via the -l flag?
