[openstack-dev] [tripleo] [tripleo-validations] using using top-level fact vars will deprecated in future Ansible versions

Emilien Macchi emilien at redhat.com
Mon Jul 23 18:33:33 UTC 2018


Thanks Monty for pointing that out to me today on #ansible-devel.

Context: https://github.com/ansible/ansible/pull/41811
The top-level fact vars are currently being deprecated in Ansible, maybe
2.7.
It looks like it only affects tripleo-validations (in a quick look), but it
could be more.
See: http://codesearch.openstack.org/?q=ansible_facts&i=nope&files=&repos=

An example playbook was written to explain what is deprecated:
https://github.com/ansible/ansible/pull/41811#issuecomment-399220997

But it seems like, starting with Ansible 2.5 (what we already have in Rocky
and beyond), we should encourage the usage of ansible_facts dictionary.
Example:
var=hostvars[inventory_hostname].ansible_facts.hostname
instead of:
var=ansible_hostname

Can we have someone from TripleO Validations to help, and make sure we make
it working for future versions of Ansible.
Also there is a way to test this behavior by disabling the
'inject_facts_as_vars' option in ansible.cfg.

Hope this helps,
-- 
Emilien Macchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20180723/cd9eb7d9/attachment.html>


More information about the OpenStack-dev mailing list