Introduce userspace group_vars and host_vars

This opens the door to using group_vars and host_vars in
userspace, by allowing the user to define a ":" delimited list
of folder that will then be used by a vars_plugin, and (maybe
later) by the inventory.

This can't override group_vars due to ansible precedence.
We could technically have this override done by moving the
group_vars into a different folder and adding it to these
environment variables.

Change-Id: Ib2cbb35c0a7bccd896fbe71c22eeb07188db99ee
This commit is contained in:
Jean-Philippe Evrard 2017-03-14 11:18:09 +00:00
parent b55cccf53a
commit 2377479d9b

View File

@ -28,6 +28,7 @@ export ANSIBLE_ACTION_PLUGINS="${ANSIBLE_ACTION_PLUGINS:-/etc/ansible/roles/plug
export ANSIBLE_CALLBACK_PLUGINS="${ANSIBLE_CALLBACK_PLUGINS:-/etc/ansible/roles/plugins/callback}"
export ANSIBLE_CALLBACK_WHITELIST="profile_tasks"
export ANSIBLE_TEST_PLUGINS="${ANSIBLE_TEST_PLUGINS:-/etc/ansible/roles/plugins/test}"
export ANSIBLE_VARS_PLUGINS="${ANSIBLE_VARS_PLUGINS:-/etc/ansible/roles/plugins/vars_plugins}"
export ANSIBLE_GATHERING="${ANSIBLE_GATHERING:-smart}"
export ANSIBLE_GATHER_SUBSET="${ANSIBLE_GATHER_SUBSET:-network,hardware,virtual}"
@ -51,3 +52,9 @@ export ANSIBLE_STRATEGY_PLUGINS="${ANSIBLE_STRATEGY_PLUGINS:-/etc/ansible/roles/
export ANSIBLE_CONNECTION_PLUGINS="${ANSIBLE_CONNECTION_PLUGINS:-/etc/ansible/roles/plugins/connection}"
export ANSIBLE_FORCE_HANDLERS="${ANSIBLE_FORCE_HANDLERS:-True}"
# Extra non-ansible default variables to use with vars_plugin.
# Allow the usage of userspace group_vars host_vars with user
# defined precedence until this behavior is merged in the
# inventory
export GROUP_VARS_PATH="${GROUP_VARS_PATH:-/etc/openstack_deploy/group_vars/}"
export HOST_VARS_PATH="${HOST_VARS_PATH:-/etc/openstack_deploy/host_vars/}"