Merge "Make pre-molecule tox playbook platform agnostic"

This commit is contained in:
Zuul 2020-01-10 15:38:40 +00:00 committed by Gerrit Code Review
commit 982ab1c6c7
4 changed files with 35 additions and 25 deletions

View File

@ -1,29 +1,27 @@
- hosts: all
vars:
tox_molecule_packages: "{{ _tox_molecule_packages | default([]) }}"
tasks:
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml"
- "vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "vars/{{ ansible_distribution | lower }}.yaml"
- "vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml"
- "vars/{{ ansible_os_family | lower }}.yaml"
tags:
- always
# psutil->python-devel
# psutil->gcc
# ansible->selinux
- name: install packages needed by molecule
when: ansible_os_family == "RedHat" and ansible_lsb.major_release|int >= 8
- name: Install packages needed by molecule
become: true
package:
name:
- python2-devel
- python2-libselinux
- python3-devel
- python3-libselinux
- gcc
name: "{{ tox_molecule_packages }}"
when:
- (tox_molecule_packages | length) > 0
- name: install packages needed by molecule
when: ansible_os_family == "RedHat" and ansible_lsb.major_release|int < 8
become: true
package:
name:
- python-devel
- libselinux-python
- gcc
- name: install docker
include_role:
name: install-docker
roles:
- role: install-docker

View File

@ -0,0 +1,6 @@
---
_tox_molecule_packages:
- python-devel
- libselinux-python
- gcc

View File

@ -0,0 +1,6 @@
---
_tox_molecule_packages:
- python3-devel
- python3-libselinux
- gcc

View File

@ -43,12 +43,12 @@ commands =
# Ansible lint
# [ANSIBLE0012] Commands should not change things if nothing needs doing
# [204] Lines should be no longer than 160 chars
bash -c "find playbooks -type f -regex '.*.ya?ml' -print0 | \
bash -c "find playbooks -type f -regex '.*.ya?ml' ! -regex '.*vars\/.*' -print0 | \
xargs -t -n1 -0 ansible-lint -xANSIBLE0012,204"
bash -c 'find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | \
xargs -t -n1 ansible-lint -xANSIBLE0012,204'
# Ansible Syntax Check
bash -c "find playbooks -type f -regex '.*.ya?ml' -exec \
bash -c "find playbooks -type f -regex '.*.ya?ml' ! -regex '.*vars\/.*' -exec \
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null"
{toxinidir}/tools/check_jobs_documented.py