Add support for extra Python packages inside Ansible runtime
At the moment there is no well defined way to supply list of extra Python requirements for Ansible venv. However, some collections for their work might require presence of extra libraries inside the execution environment. While PIP_OPTS might be used right for that, it's usage is not transparent or documented. In order to handle such need, `user-ansible-venv-requirements.txt ` is being implemented that reside inside OSA_CONFIG_DIR and contains list of required packages for installation when running bootstrap-ansible.sh Change-Id: Ic99f7eff200e2e672dcc3edd875b155af84232b7
This commit is contained in:
parent
ae6e59d1e5
commit
5b57f10eec
@ -93,6 +93,19 @@ You can override location of the ``user-collection-requirements.yml`` by
|
|||||||
setting ``USER_COLLECTION_FILE`` environment variable before running the
|
setting ``USER_COLLECTION_FILE`` environment variable before running the
|
||||||
``bootstrap-ansible.sh`` script.
|
``bootstrap-ansible.sh`` script.
|
||||||
|
|
||||||
|
Installing extra Python packages inside Ansible virtualenv
|
||||||
|
----------------------------------------------------------
|
||||||
|
|
||||||
|
Some Ansible collections may require presence of specific Python libraries
|
||||||
|
inside execution environment.
|
||||||
|
In order to accomplish that deployer can create ``/etc/openstack_deploy/user-ansible-venv-requirements.txt``
|
||||||
|
file with a list of Python libraries that should be installed inside virtual
|
||||||
|
environment along with Ansible during ``bootstrap-ansible.sh`` execution.
|
||||||
|
|
||||||
|
You can override the default path to ``user-ansible-venv-requirements.txt`` file
|
||||||
|
with ``USER_ANSIBLE_REQUIREMENTS_FILE`` environment variable before running the
|
||||||
|
``bootstrap-ansible.sh`` script.
|
||||||
|
|
||||||
Maintaining local forks of ansible roles
|
Maintaining local forks of ansible roles
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
# Use this file to fill in your third party libraries that you'd like to have
|
||||||
|
# installed inside Ansible virtual environment during bootstrap-ansible.sh.
|
||||||
|
# This file will be processed additionally to default requirements.txt and
|
||||||
|
# does not superceed it.
|
||||||
|
oauthlib>=3.2.0
|
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Implemented installation of extra Python packages inside Ansible virtual
|
||||||
|
environment. By default, extra requirements should be defined in
|
||||||
|
``/etc/openstack_deploy/user-ansible-venv-requirements.txt`` file. Path to the
|
||||||
|
requirements file can be overriden using ``USER_ANSIBLE_REQUIREMENTS_FILE``
|
||||||
|
environment variable.
|
@ -25,8 +25,9 @@ export HTTPS_PROXY=${HTTPS_PROXY:-""}
|
|||||||
export ANSIBLE_PACKAGE=${ANSIBLE_PACKAGE:-"ansible-core==2.15.5"}
|
export ANSIBLE_PACKAGE=${ANSIBLE_PACKAGE:-"ansible-core==2.15.5"}
|
||||||
export ANSIBLE_ROLE_FILE=${ANSIBLE_ROLE_FILE:-"ansible-role-requirements.yml"}
|
export ANSIBLE_ROLE_FILE=${ANSIBLE_ROLE_FILE:-"ansible-role-requirements.yml"}
|
||||||
export ANSIBLE_COLLECTION_FILE=${ANSIBLE_COLLECTION_FILE:-"ansible-collection-requirements.yml"}
|
export ANSIBLE_COLLECTION_FILE=${ANSIBLE_COLLECTION_FILE:-"ansible-collection-requirements.yml"}
|
||||||
export USER_ROLE_FILE=${USER_ROLE_FILE:-"user-role-requirements.yml"}
|
|
||||||
export USER_COLLECTION_FILE=${USER_COLLECTION_FILE:-"user-collection-requirements.yml"}
|
export USER_COLLECTION_FILE=${USER_COLLECTION_FILE:-"user-collection-requirements.yml"}
|
||||||
|
export USER_ANSIBLE_REQUIREMENTS_FILE=${USER_ANSIBLE_REQUIREMENTS_FILE:-"${OSA_CONFIG_DIR:-/etc/openstack_deploy}/user-ansible-venv-requirements.txt"}
|
||||||
|
export USER_ROLE_FILE=${USER_ROLE_FILE:-"user-role-requirements.yml"}
|
||||||
export SSH_DIR=${SSH_DIR:-"/root/.ssh"}
|
export SSH_DIR=${SSH_DIR:-"/root/.ssh"}
|
||||||
export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
|
export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
|
||||||
# check whether to install the ARA callback plugin
|
# check whether to install the ARA callback plugin
|
||||||
@ -122,6 +123,10 @@ elif [ -n "$HTTP_PROXY" ]; then
|
|||||||
PIP_OPTS+="--proxy $HTTP_PROXY"
|
PIP_OPTS+="--proxy $HTTP_PROXY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "${USER_ANSIBLE_REQUIREMENTS_FILE}" ]; then
|
||||||
|
PIP_OPTS+="--requirement $USER_ANSIBLE_REQUIREMENTS_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
PYTHON_EXEC_PATH="${PYTHON_EXEC_PATH:-$(which python3)}"
|
PYTHON_EXEC_PATH="${PYTHON_EXEC_PATH:-$(which python3)}"
|
||||||
|
|
||||||
# Obtain the SHA of the upper-constraints to use for the ansible runtime venv
|
# Obtain the SHA of the upper-constraints to use for the ansible runtime venv
|
||||||
|
Loading…
Reference in New Issue
Block a user