zuul-jobs/playbooks/tox/pre-molecule.yaml
Pierre-Louis Bonicoli 222056a26f
Avoid to use 'length' filter with null value
This error occurs when variables are null and
DEFAULT_JINJA2_NATIVE is enabled:

    object of type 'NoneType' has no len()

Change-Id: I7c69be60b846c03e30a0a6e8893bf2f3a3d5e5b8
2020-08-03 03:31:29 +02:00

27 lines
1.1 KiB
YAML

- hosts: all
vars:
tox_molecule_packages: "{{ _tox_molecule_packages | default([]) }}"
roles:
- role: ensure-docker
tasks:
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- skip: true
files:
- "molecule-vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yaml"
- "molecule-vars/{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "molecule-vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yaml"
- "molecule-vars/{{ ansible_distribution | lower }}.yaml"
- "molecule-vars/{{ ansible_os_family | lower }}-{{ ansible_distribution_version.split('.')[0] }}.yaml"
- "molecule-vars/{{ ansible_os_family | lower }}.yaml"
tags:
- always
- name: Install packages needed by molecule
become: true
package:
name: "{{ tox_molecule_packages }}"
when:
- tox_molecule_packages | default(false)