Random undefined variables (facts) since ansible 2.0 upgrade

990 views
Skip to first unread message

Michael Baydoun

unread,
Feb 3, 2016, 9:56:26 AM2/3/16
to Ansible Project
Some ansible playbook runs will work on most hosts, but 1-3 will fail with an undefined variable that is an ansible fact.  Run it a second time and it works.
Example:

fatal: [wdv-sitefinity1]: FAILED! => {"failed": true, "msg": "ERROR! The conditional check 'ansible_os_family == 'Windows'' failed. The error was: ERROR! error while evaluating conditional (ansible_os_family == 'Windows'): ERROR! 'ansible_os_family' is undefined\n\nThe error appears to have been in '/home/icansible/ansible/roles/newrelic/tasks/main.yml': line 11, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: create temp directory\n  ^ here\n"}

Michael Baydoun

unread,
Feb 10, 2016, 7:32:00 PM2/10/16
to Ansible Project
This is still occurring during our full site.yml run, but it's so far impossible to replicate in a small example.  It only occurs on our full site.yml run with no limits, any attempt to limit to certain hosts or tags result in no errors.

Alex Leonhardt

unread,
Feb 11, 2016, 2:20:23 AM2/11/16
to ansible...@googlegroups.com
I had something like it, not on Windows though,at the time the problem was that I set it not to gather_facts, when I actually tried to use a few facts later on. May not be the same but may be worth checking..

Alex
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8cf0c8f1-f1c6-4aea-8b7d-c1ca97607698%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Baydoun

unread,
Feb 11, 2016, 8:28:38 AM2/11/16
to Ansible Project
In our case, the facts are being gathered, and used other plays included in site.yml, but later on in a subsequent play the a fact that was defined previously is suddenly undefined, on some random hosts, but not all.  It's happening on windows and linux hosts.

J Hawkesworth

unread,
Feb 11, 2016, 11:48:36 AM2/11/16
to Ansible Project
Do you have fact gathering set to smart in your ansible.cfg?

Michael Baydoun

unread,
Feb 11, 2016, 12:32:02 PM2/11/16
to Ansible Project
We do, and have been looking at that.  The facts for all hosts are getting gathered/refreshed during the first included playbook in site.yml, and the cache is not supposed to be expiring for 3 hours, with our entire run taking less than 2 hours.  The cache files are present on disk, etcetera.  

We did launch a site.yml run with fact caching commented out of ansible.cfg, waiting to see how that run works.

Michael Baydoun

unread,
Feb 11, 2016, 1:20:52 PM2/11/16
to Ansible Project
Turning off fact caching completely did not improve the situation.

Michael Baydoun

unread,
Feb 12, 2016, 2:59:29 PM2/12/16
to Ansible Project
Spoke too soon, turning off fact caching fixed or worked around the problem.  Opened a bug report 
Reply all
Reply to author
Forward
0 new messages