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

29 views
Skip to first unread message

Michael Baydoun

unread,
Jan 13, 2016, 8:42:31 AM1/13/16
to Ansible Project
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.

 

Brian Coca

unread,
Jan 13, 2016, 9:45:28 AM1/13/16
to Ansible Project
That should only happen if you are using no inventory, the internal
fallback is to create a 'localhost' entry which defaults to those
groups.




--
Brian Coca

Michael Baydoun

unread,
Jan 14, 2016, 8:38:13 AM1/14/16
to Ansible Project
Thanks for the tip.  Some code that managed .ansible.cfg was misbehaving and changing the default inventory file unexpectedly.
Reply all
Reply to author
Forward
0 new messages