Allow to skip roles/collections bootstrap separately

At the moment we control need of installing both roles and
collections by `SKIP_OSA_ROLE_CLONE` environment variable.

This patch introduces SKIP_OSA_COLLECTION_CLONE variable in addition
to that, to enable operators more finely manage what needs
bootstrapping.

Change-Id: I07374bb52bebe27c94c229f1e759016cd34b286d
This commit is contained in:
Dmitriy Rabotyagov 2023-07-12 16:24:48 +02:00 committed by Dmitriy Rabotyagov
parent ea0bbd2c58
commit 6204256ff4

View File

@ -187,7 +187,6 @@ 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.
@ -206,11 +205,15 @@ if [ -f "${ANSIBLE_ROLE_FILE}" ] && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; t
export ANSIBLE_STRATEGY="linear"
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}"
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
@ -226,6 +229,5 @@ if [ -f "${ANSIBLE_ROLE_FILE}" ] && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; t
unset ANSIBLE_COLLECTIONS_PATH
unset ANSIBLE_TRANSPORT
unset ANSIBLE_STRATEGY
fi
echo "System is bootstrapped and ready for use."