# Having a hard time developing hosts file

**URL:** <https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712>\
**Category:** Ansible Project\
**Created:** [October 3, 2018, 2:44pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712 "2018-10-03T14:44:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurent\_Walker](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Laurent\_Walker](https://forum.ansible.com/u/Laurent_Walker)\
**Post date:** [October 3, 2018, 2:44pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712/1 "2018-10-03T14:44:22Z")

</div>

Below is part of the yaml host file I am trying to complete. I am having issues targeting specific groups. Most work when using ios modules but then when I use aireos modules it just skips right over and says nothing was found. Am I creating this host file correctly? Is there a better way of doing this?

all:  
children:  
na:  
children:  
uscl:  
children:  
routers:  
children:  
voice:  
wan:  
wlc:  
hosts:  
switches:  
children:  
core:  
hosts:  
access:  
hosts:

usen:  
children:  
routers:  
children:  
voice:  
hosts:

wan:  
wlc:  
switches:  
children:  
core:  
hosts:  
access:  
hosts:

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 3, 2018, 2:51pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712/2 "2018-10-03T14:51:53Z")

</div>

First, you don't seem to have any hosts defined, that is why nothing  
can be matched, you are only creating groups.

Another thing i would point out is that 'groups are always global' so  
any host or group relationship defined in one place affects the same  
group, so voice/wan only need to be defined as children of routers one  
time, no need to repeat it elsewhere. The 'routers' group under 'uscl'  
is the same group as the one under 'usen'.

---

<div class="post-metadata">

**Author:** ![Laurent\_Walker](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Laurent\_Walker](https://forum.ansible.com/u/Laurent_Walker)\
**Post date:** [October 3, 2018, 3:46pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712/3 "2018-10-03T15:46:00Z")

</div>

Hi Brian,

Thank you for your quick reply. I removed the hosts when I posted it. Can you provide an example?

regards,  
Vince

---

<div class="post-metadata">

**Author:** ![Laurent\_Walker](https://avatars.discourse-cdn.com/v4/letter/l/dfb087/32.png) [@Laurent\_Walker](https://forum.ansible.com/u/Laurent_Walker)\
**Post date:** [October 3, 2018, 3:52pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712/4 "2018-10-03T15:52:05Z")

</div>

If they are also global Routers \> WAN/Voice how will i mark a host that is in a different region as voice and in usen or uscl.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 3, 2018, 4:49pm UTC](https://forum.ansible.com/t/having-a-hard-time-developing-hosts-file/28712/5 "2018-10-03T16:49:19Z")

</div>

i'm unsure of what you are trying to do, but a host is always part of  
all the groups it is defined in, the way you have it structured it  
would always be part of all 4 groups involved.
