Skip host pip installs for ansible bootstrap
The requirements.txt contents do not need to be
installed on to the host. The majority of the
requirements are for ansible, or for release
and management tooling which needs to use the
Ansible runtime venv.
Rather than forcing the installation of pip on
the host, we only install virtualenv via distro
packages (where possible). With virtualenv in
place we can create the runtime venv and install
pip, etc and all requirements into there.
Doing this keeps the system python libraries as
clean as possible, preventing clashes with other
packages (eg: ceph) which try to install other
python libraries which conflict on CentOS.
Change-Id: I0db786645c11649764680697518c97ddf9610cfa
(cherry picked from commit b95eafb0ee
)
This commit is contained in:
parent
9b37e56802
commit
86262ae2ff
@ -174,8 +174,8 @@ values for the variables in each file that contains service credentials:
|
|||||||
|
|
||||||
.. code-block:: shell-session
|
.. code-block:: shell-session
|
||||||
|
|
||||||
# cd /opt/openstack-ansible/scripts
|
# cd /opt/openstack-ansible
|
||||||
# python pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
|
# ./scripts/pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml
|
||||||
|
|
||||||
To regenerate existing passwords, add the ``--regen`` flag.
|
To regenerate existing passwords, add the ``--regen`` flag.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/opt/ansible-runtime/bin/python
|
||||||
#
|
#
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2014, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
|
@ -64,6 +64,10 @@ case ${DISTRO_ID} in
|
|||||||
python2 python2-devel \
|
python2 python2-devel \
|
||||||
openssl-devel libffi-devel \
|
openssl-devel libffi-devel \
|
||||||
libselinux-python
|
libselinux-python
|
||||||
|
# CentOS base does not include a recent
|
||||||
|
# enough version of virtualenv or pip,
|
||||||
|
# so we do not bother trying to install
|
||||||
|
# them.
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu)
|
||||||
apt-get update
|
apt-get update
|
||||||
@ -71,7 +75,7 @@ case ${DISTRO_ID} in
|
|||||||
git-core curl gcc netcat \
|
git-core curl gcc netcat \
|
||||||
python2.7 python2.7-dev \
|
python2.7 python2.7-dev \
|
||||||
libssl-dev libffi-dev \
|
libssl-dev libffi-dev \
|
||||||
python-apt
|
python-apt python-virtualenv
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -93,24 +97,34 @@ UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7
|
|||||||
# Set the location of the constraints to use for all pip installations
|
# Set the location of the constraints to use for all pip installations
|
||||||
export UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-"$UPPER_CONSTRAINTS_PROTO://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id=$(awk '/requirements_git_install_branch:/ {print $2}' playbooks/defaults/repo_packages/openstack_services.yml)"}
|
export UPPER_CONSTRAINTS_FILE=${UPPER_CONSTRAINTS_FILE:-"$UPPER_CONSTRAINTS_PROTO://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?id=$(awk '/requirements_git_install_branch:/ {print $2}' playbooks/defaults/repo_packages/openstack_services.yml)"}
|
||||||
|
|
||||||
# Install pip on the host if it is not already installed,
|
# Install virtualenv if it is not already installed,
|
||||||
# but also make sure that it is at least version 9.x or above.
|
# but also make sure it is at least version 13.x or above
|
||||||
PIP_VERSION=$(pip --version 2>/dev/null | awk '{print $2}' | cut -d. -f1)
|
# so that it supports using the no-pip, no-setuptools
|
||||||
if [[ "${PIP_VERSION}" -lt "9" ]]; then
|
# and no-wheels options (the last one was added in v13.0.0).
|
||||||
get_pip ${PYTHON_EXEC_PATH}
|
VIRTUALENV_VERSION=$(virtualenv --version 2>/dev/null | cut -d. -f1)
|
||||||
# Ensure that our shell knows about the new pip
|
if [[ "${VIRTUALENV_VERSION}" -lt "13" ]]; then
|
||||||
hash -r pip
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install the requirements for the various python scripts
|
# Install pip on the host if it is not already installed,
|
||||||
# on to the host, including virtualenv.
|
# but also make sure that it is at least version 7.x or above
|
||||||
pip install ${PIP_OPTS} \
|
# so that it supports the use of the constraint option which
|
||||||
--requirement requirements.txt \
|
# was added in pip 7.1.
|
||||||
--constraint ${UPPER_CONSTRAINTS_FILE} \
|
PIP_VERSION=$(pip --version 2>/dev/null | awk '{print $2}' | cut -d. -f1)
|
||||||
|| pip install ${PIP_OPTS} \
|
if [[ "${PIP_VERSION}" -lt "7" ]]; then
|
||||||
--requirement requirements.txt \
|
get_pip ${PYTHON_EXEC_PATH}
|
||||||
--constraint ${UPPER_CONSTRAINTS_FILE} \
|
# Ensure that our shell knows about the new pip
|
||||||
--isolated
|
hash -r pip
|
||||||
|
fi
|
||||||
|
|
||||||
|
pip install ${PIP_OPTS} \
|
||||||
|
--constraint ${UPPER_CONSTRAINTS_FILE} \
|
||||||
|
virtualenv \
|
||||||
|
|| pip install ${PIP_OPTS} \
|
||||||
|
--constraint ${UPPER_CONSTRAINTS_FILE} \
|
||||||
|
--isolated \
|
||||||
|
virtualenv
|
||||||
|
# Ensure that our shell knows about the new virtualenv
|
||||||
|
hash -r virtualenv
|
||||||
|
fi
|
||||||
|
|
||||||
# Create a Virtualenv for the Ansible runtime
|
# Create a Virtualenv for the Ansible runtime
|
||||||
virtualenv --python="${PYTHON_EXEC_PATH}" \
|
virtualenv --python="${PYTHON_EXEC_PATH}" \
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/opt/ansible-runtime/bin/python
|
||||||
# Copyright 2014, Rackspace US, Inc.
|
# Copyright 2014, Rackspace US, Inc.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
Loading…
Reference in New Issue
Block a user