# Inventory issue

**URL:** <https://forum.ansible.com/t/inventory-issue/19517>\
**Category:** Ansible Project\
**Created:** [October 15, 2015, 4:49pm UTC](https://forum.ansible.com/t/inventory-issue/19517 "2015-10-15T16:49:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabor.debreczeni](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@gabor.debreczeni](https://forum.ansible.com/u/gabor.debreczeni)\
**Post date:** [October 15, 2015, 4:49pm UTC](https://forum.ansible.com/t/inventory-issue/19517/1 "2015-10-15T16:49:59Z")

</div>

Hi guys,

I’m facing with an issue and I cannot find the reason for this behaviour of ansible:  
My hosts file (part of it):

[lb]  
lb[1:2]

lb3

The result in command line:

ansible -a whoami lb  
lb1 | success | rc=0 \>\>  
root

lb2 | success | rc=0 \>\>  
root

lb3 | success | rc=0 \>\>  
root

In my opinion the above command should check only lb1 and lb2, as lb3 is not the part of the lb group.  
Can anyone tell me why it’s catching the 3rd lb node?  
Strange thing is if I’m removing the lb3 from it’s current place in the hosts file and placing it somewhere else, then the issue is gone, for example:

[lb]  
lb[1:2]

[payment]  
payment[1:3]

lb3

I think parsing the hosts file is wrong in ansible in this case.  
Thanks.

---

<div class="post-metadata">

**Author:** ![David\_Karban](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@David\_Karban](https://forum.ansible.com/u/David_Karban)\
**Post date:** [October 15, 2015, 5:01pm UTC](https://forum.ansible.com/t/inventory-issue/19517/2 "2015-10-15T17:01:52Z")

</div>

Hi,

it is because lb3 is in lb group. Group ends when new group start, in your second case lb3 is in payment group.

For lb3 to be in all group only it must be defined before any group is started.

David

Dne 15. 10. 2015 18:50 napsal uživatel \<[gabor.debreczeni@privax.com](mailto:gabor.debreczeni@privax.com)\>:

---

<div class="post-metadata">

**Author:** ![esco\_real](https://avatars.discourse-cdn.com/v4/letter/e/c89c15/32.png) [@esco\_real](https://forum.ansible.com/u/esco_real)\
**Post date:** [October 15, 2015, 5:05pm UTC](https://forum.ansible.com/t/inventory-issue/19517/3 "2015-10-15T17:05:31Z")

</div>

Hello,

if you don’t want to put lb3 in a group you would need this:

lb3  
[lb]  
lb[1:2]

A blank line doesn’t separate anything. In your second example lb3 is in the payment group.  
[http://docs.ansible.com/ansible/intro\_inventory.html](http://docs.ansible.com/ansible/intro_inventory.html)

[https://en.wikipedia.org/wiki/INI\_file](https://en.wikipedia.org/wiki/INI_file)

esco

---

<div class="post-metadata">

**Author:** ![gabor.debreczeni](https://avatars.discourse-cdn.com/v4/letter/g/e9c0ed/32.png) [@gabor.debreczeni](https://forum.ansible.com/u/gabor.debreczeni)\
**Post date:** [October 16, 2015, 10:31am UTC](https://forum.ansible.com/t/inventory-issue/19517/4 "2015-10-16T10:31:11Z")

</div>

Thank you guys, I moved now all standalone hosts to the front of the inventory file (before the group definitions) and the issue is gone.
