rally/tests/ci/playbooks/rally-install-pre.yaml

85 lines
2.9 KiB
YAML

- hosts: all
name: Prepare host to install Rally
tasks:
- name: Check OS distro (CentOS)
when: ansible_distribution == "CentOS"
set_fact:
# in case of centos we do not care about minor versions
os_distro: '{{ ansible_distribution }} {{ ansible_distribution_major_version }}'
- name: Check OS distro (Ubuntu)
when: ansible_distribution == "Ubuntu"
set_fact:
os_distro: '{{ ansible_distribution }} {{ ansible_distribution_version }}'
- name: Install required packages (Centos-7)
when: os_distro == "CentOS 7"
shell:
cmd: |
sudo yum remove -y python-crypto || true
sudo yum remove -y python36-PyYAML || true
sudo yum update
sudo yum install -y yum-utils
sudo yum groupinstall -y development
sudo yum install -y https://repo.ius.io/ius-release-el7.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y python36u python36u-devel
- name: Uninstall required packages (Centos-8)
when: os_distro == "CentOS 8"
become: true
shell: dnf remove -y python3-pyyaml
- name: Install required packages (Ubuntu-Bionic)
when: os_distro == "Ubuntu 18.04"
shell:
chdir: '{{ zuul.project.src_dir }}'
cmd: |
# NOTE(pabelanger): We run apt-get update to ensure we dont have a stale
# package cache in the gate.
sudo apt update
sudo apt install --yes python3.6-dev
- name: Install required packages (Ubuntu-Focal)
when: os_distro == "Ubuntu 20.04"
shell:
chdir: '{{ zuul.project.src_dir }}'
cmd: |
# NOTE(pabelanger): We run apt-get update to ensure we dont have a stale
# package cache in the gate.
sudo apt update
sudo apt install --yes python3.8-dev
- name: Install pip3 if needed
when: os_distro == "CentOS 7" or os_distro == "Ubuntu 18.04" or os_distro == "Ubuntu 20.04"
shell:
executable: /bin/bash
chdir: '{{ zuul.project.src_dir }}'
cmd: |
python_version=`python3 --version`
python_version=`echo $python_version |awk '{print $2}'`
echo $python_version
if [[ $python_version =~ ^3.6 ]]; then
pip_url=https://bootstrap.pypa.io/pip/3.6/get-pip.py
else
pip_url=https://bootstrap.pypa.io/get-pip.py
fi
curl $pip_url -o /tmp/get-pip.py
sudo python3 /tmp/get-pip.py
- name: Update pip3 if needed
when: os_distro == "CentOS 8"
become: true
shell: pip3 install --upgrade pip
- name: Install bindep
become: true
shell: pip3 install --upgrade bindep PyYAML
- name: Prepare rally plugins stored at home dir
shell:
cmd: |
mkdir --parents ~/.rally/plugins
cp --recursive {{ zuul.project.src_dir }}/rally-jobs/plugins/* ~/.rally/plugins