107 lines
2.8 KiB
YAML
107 lines
2.8 KiB
YAML
---
|
|
- name: Get python_v fact for py2 or py3 common vars
|
|
include_tasks: check_set_py3.yaml
|
|
|
|
- name: Make sure workspace exists
|
|
file:
|
|
path: '{{ workspace }}'
|
|
state: directory
|
|
|
|
- name: Install pip
|
|
become: true
|
|
package:
|
|
name: "python3-pip"
|
|
state: present
|
|
|
|
- name: Install virtualenv/pyyaml from epel
|
|
yum:
|
|
name:
|
|
- python36-virtualenv
|
|
- python36-PyYAML
|
|
enablerepo: epel
|
|
state: present
|
|
become: true
|
|
when: ansible_distribution_major_version|int == 7
|
|
|
|
- name: Install PyYAML and virtualenv
|
|
package:
|
|
name:
|
|
- "python3-virtualenv"
|
|
- "python3-pyyaml"
|
|
state: present
|
|
become: true
|
|
when: ansible_distribution_major_version|int >= 8
|
|
|
|
- name: Install python3-devel with provides pathfix.py
|
|
package:
|
|
name: python3-devel
|
|
state: present
|
|
become: true
|
|
|
|
- name: Create a script that fixes shebang for python3
|
|
template:
|
|
src: pathfix_repos.sh.j2
|
|
dest: "{{ workspace }}/pathfix_repos.sh"
|
|
mode: u=rwx
|
|
|
|
- name: Fix shebang path for python3
|
|
command: bash {{ workspace }}/pathfix_repos.sh
|
|
changed_when: true
|
|
|
|
- name: Install python3-setuptools
|
|
package:
|
|
name: "python3-setuptools"
|
|
state: present
|
|
become: true
|
|
when: python_v == "py3"
|
|
|
|
- name: Install python-setuptools
|
|
package:
|
|
name: "python-setuptools"
|
|
state: present
|
|
become: true
|
|
when: python_v == "py2"
|
|
|
|
- name: Ensure a recent version of pip is installed
|
|
pip:
|
|
name: "pip>=19.1.1"
|
|
virtualenv: "{{ workspace }}/venv"
|
|
virtualenv_command: "/usr/bin/python3 -m venv"
|
|
|
|
- name: Install deps from upper-constraints
|
|
when: ansible_distribution == 'CentOS'
|
|
pip:
|
|
extra_args: "-c {{ openstack_git_root }}/requirements/upper-constraints.txt"
|
|
requirements: "{{ openstack_git_root }}/{{ item }}/requirements.txt"
|
|
virtualenv: "{{ workspace }}/venv"
|
|
virtualenv_command: "/usr/bin/python3 -m venv"
|
|
with_items:
|
|
- diskimage-builder
|
|
- tripleo-common
|
|
- tripleo-ansible
|
|
- python-tripleoclient
|
|
|
|
- name: pip install tripleo items
|
|
pip:
|
|
name: "{{ tripleo_pip_projects }}"
|
|
state: present
|
|
virtualenv: "{{ workspace }}/venv"
|
|
virtualenv_command: "/usr/bin/python3 -m venv"
|
|
|
|
# Workaround for https://bugs.launchpad.net/diskimage-builder/+bug/1745626
|
|
# venv created with 'python3 -m venv' does not have activate_this.py
|
|
# TODO(rfolco): Remove this workaround when bug #1745626 is fixed
|
|
- name: "Workaround for bug #1745626"
|
|
block:
|
|
- name: Create temp venv w/ virtualenv command
|
|
pip:
|
|
name: setuptools
|
|
virtualenv: "{{ workspace }}/.tmp"
|
|
virtualenv_command: "{{ 'virtualenv' if ansible_distribution_major_version is version('9', '==') else 'virtualenv-3' }}"
|
|
|
|
- name: Borrow activate_this.py
|
|
copy:
|
|
src: "{{ workspace }}/.tmp/bin/activate_this.py"
|
|
dest: "{{ workspace }}/venv/bin/"
|
|
remote_src: true
|