# In 2.0, when is the inventory read and the special "groups" variable populated?

**URL:** <https://forum.ansible.com/t/in-2-0-when-is-the-inventory-read-and-the-special-groups-variable-populated/20197>\
**Category:** Ansible Project\
**Created:** [January 13, 2016, 1:42pm UTC](https://forum.ansible.com/t/in-2-0-when-is-the-inventory-read-and-the-special-groups-variable-populated/20197 "2016-01-13T13:42:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Baydoun](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Michael\_Baydoun](https://forum.ansible.com/u/Michael_Baydoun)\
**Post date:** [January 13, 2016, 1:42pm UTC](https://forum.ansible.com/t/in-2-0-when-is-the-inventory-read-and-the-special-groups-variable-populated/20197/1 "2016-01-13T13:42:30Z")

</div>

Our playbooks set facts similar to

- name: illustrate problem  
set\_fact:  
monitoringServer: “{{ groups.nagios.0 }}”

In 1.9.x that would evaluate to the first server in the nagios group in inventory  
In 2.0, groups doesn’t contain a value for nagios, or any other inventory group. It only contains “all” and “ungrouped”, both of which contain localhost.

---

<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:** [January 13, 2016, 2:45pm UTC](https://forum.ansible.com/t/in-2-0-when-is-the-inventory-read-and-the-special-groups-variable-populated/20197/2 "2016-01-13T14:45:08Z")

</div>

That should only happen if you are using no inventory, the internal  
fallback is to create a 'localhost' entry which defaults to those  
groups.

---

<div class="post-metadata">

**Author:** ![Michael\_Baydoun](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Michael\_Baydoun](https://forum.ansible.com/u/Michael_Baydoun)\
**Post date:** [January 14, 2016, 1:38pm UTC](https://forum.ansible.com/t/in-2-0-when-is-the-inventory-read-and-the-special-groups-variable-populated/20197/3 "2016-01-14T13:38:13Z")

</div>

Thanks for the tip. Some code that managed .ansible.cfg was misbehaving and changing the default inventory file unexpectedly.
