---
-# The mitogen module used in kubespray requires python2 on the nodes.
# On some distributions (i.e. Ubuntu 18.04), the default version of
-# python is python3.
+# python is python3 and there is no /usr/bin/python executable.
#
-# When python2 is not present a failure message similar to "bash:
+# When not present a failure message similar to "bash:
# /usr/bin/python: No such file or directory" will be reported.
#
# Note the use of "strategy: linear" below to temporarily bypass
# mitogen.
#
-- name: Install python2
+- name: Install python3 as preferred alternative
hosts: k8s-cluster
strategy: linear
tasks:
- - name: Install python2
- package:
- name: python
- state: present
+ - name: Install python3 as preferred alternative
+ command: update-alternatives --install /usr/bin/python python /usr/bin/python3 1
`$ sudo apt-get upgrade -y`
-`$ sudo apt-get install -y python-pip`
+`$ sudo apt-get install -y python3-pip`
+
+`$ sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1`
`$ git clone https://git.onap.org/multicloud/k8s/`
unzip \
vim \
wget
+ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
}
# _install_ansible() - Install and Configure Ansible program
local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml |
awk -F ': ' '{print $2}')
mkdir -p /etc/ansible/
- pip3 install --no-cache-dir ansible==$version
+ pip install --no-cache-dir ansible==$version
}
function install_kubespray {
rm $tarball
pushd $dest_folder/kubespray-$version/
- pip3 install --no-cache-dir -r ./requirements.txt
+ pip install --no-cache-dir -r ./requirements.txt
make mitogen
popd
rm -f $kud_inventory_folder/group_vars/all.yml 2> /dev/null
# _install_ansible() - Install and Configure Ansible program
function _install_ansible {
- sudo apt-get install -y python3-pip
- sudo -E pip3 install --no-cache-dir --upgrade pip
+ sudo apt-get install -y python3 python3-pip
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 --force
+ sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 --force
+ sudo -E pip install --no-cache-dir --upgrade pip
if $(ansible --version &>/dev/null); then
- sudo pip3 uninstall -y ansible
+ sudo pip uninstall -y ansible
fi
local version=$(grep "ansible_version" ${kud_playbooks}/kud-vars.yml | awk -F ': ' '{print $2}')
sudo mkdir -p /etc/ansible/
- sudo -E pip3 install --no-cache-dir ansible==$version
+ sudo -E pip install --no-cache-dir ansible==$version
}
function _set_environment_file {
rm $tarball
pushd $dest_folder/kubespray-$version/
- sudo -E pip3 install --no-cache-dir -r ./requirements.txt
+ sudo -E pip install --no-cache-dir -r ./requirements.txt
make mitogen
popd
rm -f $kud_inventory_folder/group_vars/all.yml 2> /dev/null
# install_plugin() - Install ONAP Multicloud Kubernetes plugin
function install_plugin {
echo "Installing multicloud/k8s plugin"
- sudo -E pip3 install --no-cache-dir docker-compose
+ sudo -E pip install --no-cache-dir docker-compose
sudo mkdir -p /opt/{kubeconfig,consul/config}
sudo cp $HOME/.kube/config /opt/kubeconfig/kud
*suse)
;;
ubuntu|debian)
+ apt-get update
apt-get install -y cpu-checker
kvm-ok
;;
case ${ID,,} in
*suse)
INSTALLER_CMD="sudo -H -E zypper -q install -y --no-recommends"
- packages+=(python-devel)
+ packages+=(python-devel python-pip)
# Vagrant installation
if [[ "${enable_vagrant_install+x}" ]]; then
ubuntu|debian)
INSTALLER_CMD="sudo -H -E apt-get -y -q=3 install"
- packages+=(python-dev)
+ packages+=(python3-dev python3-pip)
# Vagrant installation
if [[ "${enable_vagrant_install+x}" ]]; then
PKG_MANAGER=$(which dnf || which yum)
sudo "$PKG_MANAGER" updateinfo
INSTALLER_CMD="sudo -H -E ${PKG_MANAGER} -q -y install"
- packages+=(python-devel)
+ packages+=(python-devel python-pip)
# Vagrant installation
if [[ "${enable_vagrant_install+x}" ]]; then
sudo modprobe vhost_net
${INSTALLER_CMD} "${packages[@]}"
-if ! which pip; then
- curl -sL https://bootstrap.pypa.io/pip/2.7/get-pip.py | sudo python
-else
- sudo -H -E pip install --no-cache-dir --upgrade pip
-fi
+case ${ID,,} in
+ ubuntu|debian)
+ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 --force
+ sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 --force
+ ;;
+esac
+sudo -H -E pip install --no-cache-dir --upgrade pip
sudo -H -E pip install --no-cache-dir tox
if [[ ${http_proxy+x} ]]; then
vagrant plugin install vagrant-proxyconf
function setup_dependencies {
apt-get update
- apt-get install -y curl gnupg2 pciutils make gcc libnuma-dev python git linux-headers-`uname -r` module-init-tools libssl-dev
+ apt-get install -y curl gnupg2 pciutils make gcc libnuma-dev git linux-headers-`uname -r` module-init-tools libssl-dev
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu bionic main" >> /etc/apt/sources.list.d/99fd.io.list
curl -L https://packagecloud.io/fdio/master/gpgkey | apt-key add -
}
git clone http://dpdk.org/git/apps/pktgen-dpdk
KERNEL_VERSION=$(uname -r)
echo $KERNEL_VERSION
- sudo apt-get install -y linux-headers-$KERNEL_VERSION libpcap-dev gcc make libnuma-dev liblua5.3-dev python
+ sudo apt-get install -y linux-headers-$KERNEL_VERSION libpcap-dev gcc make libnuma-dev liblua5.3-dev
}
function build_dpdk {
function setup_dependencies {
apt-get update
- apt-get install -y curl gnupg2 pciutils make gcc libnuma-dev python git linux-headers-`uname -r` module-init-tools libssl-dev
+ apt-get install -y curl gnupg2 pciutils make gcc libnuma-dev git linux-headers-`uname -r` module-init-tools libssl-dev
echo "deb [trusted=yes] https://packagecloud.io/fdio/release/ubuntu bionic main" >> /etc/apt/sources.list.d/99fd.io.list
curl -L https://packagecloud.io/fdio/master/gpgkey | apt-key add -
}