Force ansible to ignore plugins when bootstrapping

When ansible is bootstrapping an environment there can be conflicts with
the ansible plugins we use by default, especially in the case of an
upgrade. This change sets all of the plugin environment variables to
/dev/null so that ansible ignores the existance of all plugins during
the bootstrap process.

Change-Id: I3b03e4c67c589eae528ad6400023c4247a5ca6e6
Closes-Bug: #1741221
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-01-16 10:46:49 -06:00 committed by Kevin Carter (cloudnull)
parent 9499621f61
commit 03d2f664be

View File

@ -286,12 +286,37 @@ if [ -f "${ANSIBLE_ROLE_FILE}" ]; then
ansible-galaxy install --role-file="${ANSIBLE_ROLE_FILE}" \
--force
elif [[ "${ANSIBLE_ROLE_FETCH_MODE}" == 'git-clone' ]];then
# NOTE(cloudnull): When bootstrapping we don't want ansible to interact
# with our plugins by default. This change will force
# ansible to ignore our plugins during this process.
export ANSIBLE_LIBRARY="/dev/null"
export ANSIBLE_LOOKUP_PLUGINS="/dev/null"
export ANSIBLE_FILTER_PLUGINS="/dev/null"
export ANSIBLE_ACTION_PLUGINS="/dev/null"
export ANSIBLE_CALLBACK_PLUGINS="/dev/null"
export ANSIBLE_CALLBACK_WHITELIST="/dev/null"
export ANSIBLE_TEST_PLUGINS="/dev/null"
export ANSIBLE_VARS_PLUGINS="/dev/null"
export ANSIBLE_STRATEGY_PLUGINS="/dev/null"
export ANSIBLE_CONFIG="none-ansible.cfg"
pushd tests
/opt/ansible-runtime/bin/ansible-playbook get-ansible-role-requirements.yml \
-i ${OSA_CLONE_DIR}/tests/test-inventory.ini \
-e role_file="${ANSIBLE_ROLE_FILE}" \
-vvv
popd
unset ANSIBLE_LIBRARY
unset ANSIBLE_LOOKUP_PLUGINS
unset ANSIBLE_FILTER_PLUGINS
unset ANSIBLE_ACTION_PLUGINS
unset ANSIBLE_CALLBACK_PLUGINS
unset ANSIBLE_CALLBACK_WHITELIST
unset ANSIBLE_TEST_PLUGINS
unset ANSIBLE_VARS_PLUGINS
unset ANSIBLE_STRATEGY_PLUGINS
unset ANSIBLE_CONFIG
else
echo "Please set the ANSIBLE_ROLE_FETCH_MODE to either of the following options ['galaxy', 'git-clone']"
exit 99