Merge "Bootstrap Ansible with Python3 on Ubuntu"
This commit is contained in:
commit
22a9a5624d
@ -70,20 +70,13 @@ case ${DISTRO_ID} in
|
|||||||
ubuntu)
|
ubuntu)
|
||||||
apt-get update
|
apt-get update
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||||
git python-all python-dev curl python2.7-dev build-essential \
|
git python3-all python3-dev curl python3.5-dev build-essential \
|
||||||
libssl-dev libffi-dev netcat python-requests python-openssl python-pyasn1 \
|
libssl-dev libffi-dev netcat python3-requests python3-openssl python3-pyasn1 \
|
||||||
python-netaddr python-prettytable python-crypto python-yaml \
|
python3-netaddr python3-prettytable python3-crypto python3-yaml \
|
||||||
python-virtualenv
|
python3-virtualenv
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# NOTE(mhayden): Ubuntu 16.04 needs python-ndg-httpsclient for SSL SNI support.
|
|
||||||
# This package is not needed in Ubuntu 14.04 and isn't available
|
|
||||||
# there as a package.
|
|
||||||
if [[ "${DISTRO_ID}" == 'ubuntu' ]] && [[ "${DISTRO_VERSION_ID}" == '16.04' ]]; then
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get -y install python-ndg-httpsclient
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install pip
|
# Install pip
|
||||||
get_pip
|
get_pip
|
||||||
|
|
||||||
@ -96,7 +89,7 @@ elif [ -n "$HTTP_PROXY" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Figure out the version of python is being used
|
# Figure out the version of python is being used
|
||||||
PYTHON_EXEC_PATH="$(which python2 || which python)"
|
PYTHON_EXEC_PATH="$(which python3 || which python2 || which python)"
|
||||||
PYTHON_VERSION="$($PYTHON_EXEC_PATH -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
|
PYTHON_VERSION="$($PYTHON_EXEC_PATH -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
|
||||||
|
|
||||||
# Use https when Python with native SNI support is available
|
# Use https when Python with native SNI support is available
|
||||||
@ -106,6 +99,12 @@ UPPER_CONSTRAINTS_PROTO=$([ "$PYTHON_VERSION" == $(echo -e "$PYTHON_VERSION\n2.7
|
|||||||
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)"}
|
||||||
|
|
||||||
# Create a Virtualenv for the Ansible runtime
|
# Create a Virtualenv for the Ansible runtime
|
||||||
|
if [ -f "/opt/ansible-runtime/bin/python" ]; then
|
||||||
|
VENV_PYTHON_VERSION="$(/opt/ansible-runtime/bin/python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')"
|
||||||
|
if [ "$PYTHON_VERSION" != "$VENV_PYTHON_VERSION" ]; then
|
||||||
|
rm -rf /opt/ansible-runtime
|
||||||
|
fi
|
||||||
|
fi
|
||||||
virtualenv --clear ${VIRTUALENV_OPTIONS} --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime
|
virtualenv --clear ${VIRTUALENV_OPTIONS} --python="${PYTHON_EXEC_PATH}" /opt/ansible-runtime
|
||||||
|
|
||||||
# The vars used to prepare the Ansible runtime venv
|
# The vars used to prepare the Ansible runtime venv
|
||||||
|
@ -23,7 +23,9 @@ packages_install:
|
|||||||
- linux-image-extra-{{ ansible_kernel }}
|
- linux-image-extra-{{ ansible_kernel }}
|
||||||
- lvm2
|
- lvm2
|
||||||
- python2.7
|
- python2.7
|
||||||
|
- python-crypto
|
||||||
- python-dev
|
- python-dev
|
||||||
|
- python-yaml
|
||||||
- sshpass
|
- sshpass
|
||||||
- tmux
|
- tmux
|
||||||
- vim
|
- vim
|
||||||
|
Loading…
x
Reference in New Issue
Block a user