zuul-jobs/roles/ensure-tox/molecule/default/playbook.yml

61 lines
2.0 KiB
YAML

---
- name: Converge
hosts: all
gather_facts: true
tasks:
- name: Include OS specific variables
include_vars: "{{ item }}"
failed_when: false
loop:
- "family-{{ ansible_os_family | lower }}.yml"
- "family-{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version.split('.')[0:2] | join('-') | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version.split('.')[0:3] | join('-') | lower }}.yml"
- name: installing requirements
package:
name: "{{ pkg_tox_pre|default('curl') }}"
# current code in ensure-tox makes the assumption that `pip` is installed.
- name: ensure-pip
become: yes
environment:
PIP_NO_WARN_SCRIPT_LOCATION: "1"
shell: |
set -exu
{{ ansible_python.executable }} -m pip --version || {
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
{{ ansible_python.executable }} get-pip.py
}
{{ ansible_python.executable }} -m pip --version
- name: include ensure-tox before installing system tox
include_role:
name: ensure-tox
- name: include ensure-tox with upgrade
vars:
tox_upgrade: true
include_role:
name: ensure-tox
- name: installing system tox
package:
name: "{{ pkg_tox | default('python-tox') }}"
update_cache: |
{{ ansible_version.full is version_compare('2.7.0', '>=') or omit }}
- name: include ensure-tox after installing system tox
include_role:
name: ensure-tox
- name: include ensure-tox with upgrade after installing system tox
vars:
tox_upgrade: true
include_role:
name: ensure-tox