Conditional check not working since upgrading to v.2.0.0.2

Hi all,

Since upgrading to Ansible 2.0.0.2 the following code has stopped working:

  • include: redhat-hosts.yml
    when: ansible_os_family == ‘RedHat’

This results in the error:

ERROR! The conditional check ‘ansible_os_family == ‘RedHat’’ failed. The error was: ERROR! error while evaluating conditional (ansible_os_family == ‘RedHat’): ERROR! ‘ansible_os_family’ is undefined

This worked fine in 1.9.x - I can’t find anything in the docs to suggest why this would stop working with the upgrade to v2.x. I did wonder if the name of the fact had changed in v2.x but a quick run of the setup module confirms that the fact is present. I am using the default fact gathering configuration and am not using fact caching.

Anyone have any ideas?

Cheers,

Edd

are you gathering facts?

Hi Brian,

I was gathering facts when using Ansible 1.9.x and have done nothing to disable it since upgrading to 2.x. (Unless 2.x disables it by default and I’ve not noticed that in the docs?)

Cheers,

Edd

no, facts should be gathered as normal, can you put in the following
task before the problem?

- debug: var=hostvars[inventory_hostname]