diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index 83e929c2ad..ef11ed0664 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -187,45 +187,47 @@ echo "openstack-ansible wrapper created." [[ -d "/etc/ansible/plugins" ]] && rm -rf "/etc/ansible/plugins" # Update dependent roles -if [ -f "${ANSIBLE_ROLE_FILE}" ] && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; 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="${OSA_CLONE_DIR}/playbooks/library" - 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_CALLBACKS_ENABLED="/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" - export ANSIBLE_COLLECTIONS_PATH="/etc/ansible" - export ANSIBLE_TRANSPORT="smart" - export ANSIBLE_STRATEGY="linear" +# 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="${OSA_CLONE_DIR}/playbooks/library" +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_CALLBACKS_ENABLED="/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" +export ANSIBLE_COLLECTIONS_PATH="/etc/ansible" +export ANSIBLE_TRANSPORT="smart" +export ANSIBLE_STRATEGY="linear" - pushd scripts +pushd scripts +if ([ -f "${ANSIBLE_COLLECTION_FILE}" ] || [ -f "${USER_COLLECTION_FILE}" ]) && [[ -z "${SKIP_OSA_COLLECTION_CLONE+defined}" ]]; then /opt/ansible-runtime/bin/ansible-playbook get-ansible-collection-requirements.yml \ -e collection_file="${ANSIBLE_COLLECTION_FILE}" -e user_collection_file="${USER_COLLECTION_FILE}" - - /opt/ansible-runtime/bin/ansible-playbook get-ansible-role-requirements.yml \ - -e role_file="${ANSIBLE_ROLE_FILE}" -e user_role_file="${USER_ROLE_FILE}" - popd - - unset ANSIBLE_LIBRARY - unset ANSIBLE_LOOKUP_PLUGINS - unset ANSIBLE_FILTER_PLUGINS - unset ANSIBLE_ACTION_PLUGINS - unset ANSIBLE_CALLBACK_PLUGINS - unset ANSIBLE_CALLBACKS_ENABLED - unset ANSIBLE_TEST_PLUGINS - unset ANSIBLE_VARS_PLUGINS - unset ANSIBLE_STRATEGY_PLUGINS - unset ANSIBLE_CONFIG - unset ANSIBLE_COLLECTIONS_PATH - unset ANSIBLE_TRANSPORT - unset ANSIBLE_STRATEGY fi +if ([ -f "${ANSIBLE_ROLE_FILE}" ] || [ -f "${USER_ROLE_FILE}" ]) && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; then + /opt/ansible-runtime/bin/ansible-playbook get-ansible-role-requirements.yml \ + -e role_file="${ANSIBLE_ROLE_FILE}" -e user_role_file="${USER_ROLE_FILE}" +fi +popd + +unset ANSIBLE_LIBRARY +unset ANSIBLE_LOOKUP_PLUGINS +unset ANSIBLE_FILTER_PLUGINS +unset ANSIBLE_ACTION_PLUGINS +unset ANSIBLE_CALLBACK_PLUGINS +unset ANSIBLE_CALLBACKS_ENABLED +unset ANSIBLE_TEST_PLUGINS +unset ANSIBLE_VARS_PLUGINS +unset ANSIBLE_STRATEGY_PLUGINS +unset ANSIBLE_CONFIG +unset ANSIBLE_COLLECTIONS_PATH +unset ANSIBLE_TRANSPORT +unset ANSIBLE_STRATEGY + echo "System is bootstrapped and ready for use."