From a892a6ef03a0b4e0e6fc7b66c20f82154cad8a8d Mon Sep 17 00:00:00 2001 From: skylerbunny Date: Mon, 17 Sep 2018 04:08:25 -0700 Subject: [PATCH] Add undocumented configuration parameter and explain in porting guide (#36059) * Add undocumented configuration parameter and explain in porting guide --- .../rst/porting_guides/porting_guide_2.5.rst | 15 +++++++++++++++ examples/ansible.cfg | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/docs/docsite/rst/porting_guides/porting_guide_2.5.rst b/docs/docsite/rst/porting_guides/porting_guide_2.5.rst index ce0ef8f1ba..da15bd33ee 100644 --- a/docs/docsite/rst/porting_guides/porting_guide_2.5.rst +++ b/docs/docsite/rst/porting_guides/porting_guide_2.5.rst @@ -137,6 +137,21 @@ See :ref:`playbooks_tests` for more information. Additionally, a script was created to assist in the conversion for tests using filter syntax to proper jinja test syntax. This script has been used to convert all of the Ansible integration tests to the correct format. There are a few limitations documented, and all changes made by this script should be evaluated for correctness before executing the modified playbooks. The script can be found at `https://github.com/ansible/ansible/blob/devel/hacking/fix_test_syntax.py `_. +Ansible fact namespacing +------------------------ + +Ansible facts, which have historically been written to names like ``ansible_*`` +in the main facts namespace, have been placed in their own new namespace, +``ansible_facts.*`` For example, the fact ``ansible_distribution`` is now best +queried through the variable structure ``ansible_facts.distribution``. + +A new configuration variable, ``inject_facts_as_vars``, has been added to +ansible.cfg. Its default setting, 'True', keeps the 2.4 behavior of facts +variables being set in the old ``ansible_*`` locations (while also writing them +to the new namespace). This variable is expected to be set to 'False' in a +future release. When ``inject_facts_as_vars`` is set to False, you must +refer to ansible_facts through the new ``ansible_facts.*`` namespace. + Modules ======= diff --git a/examples/ansible.cfg b/examples/ansible.cfg index f01abf56bf..1bccd57c08 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -55,6 +55,15 @@ # environment. # gather_timeout = 10 +# Ansible facts are available inside the ansible_facts.* dictionary +# namespace. This setting maintains the behaviour which was the default prior +# to 2.5, duplicating these variables into the main namespace, each with a +# prefix of 'ansible_'. +# This variable is set to True by default for backwards compatibility. It +# will be changed to a default of 'False' in a future release. +# ansible_facts. +# inject_facts_as_vars = True + # additional paths to search for roles in, colon separated #roles_path = /etc/ansible/roles