56 lines
1.7 KiB
YAML
56 lines
1.7 KiB
YAML
---
|
|
- hosts: ubuntu-focal
|
|
roles:
|
|
- role: ensure-clouds-yaml
|
|
- role: ensure-molecule
|
|
vars:
|
|
molecule_version: 3.5.2
|
|
|
|
- hosts: ubuntu-focal
|
|
tasks:
|
|
# TODO(mnaser): Get artifact from build job
|
|
- name: Build & Install collection
|
|
block:
|
|
- name: Install build-time dependencies
|
|
become: true
|
|
pip:
|
|
name: ['pbr', 'pyyaml']
|
|
- name: Generate galaxy.yml file
|
|
shell: python3 {{ zuul.project.src_dir }}/tools/generate-galaxy-yml.py
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}"
|
|
- name: Install collection
|
|
shell: ansible-galaxy collection install -f {{ zuul.project.src_dir }}
|
|
|
|
- shell: molecule create
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}"
|
|
|
|
- shell: molecule prepare
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}"
|
|
|
|
- name: Grab the Molecule instance configuration
|
|
set_fact:
|
|
molecule_instance_config: "{{ lookup('file', molecule_instance_config_path) | from_yaml }}"
|
|
vars:
|
|
molecule_instance_config_path: "{{ ansible_user_dir }}/.cache/molecule/{{ zuul.project.short_name }}/default/instance_config.yml"
|
|
|
|
- name: Add all of the hosts to the inventory
|
|
add_host:
|
|
name: "{{ item.instance }}"
|
|
groups: ["molecule"]
|
|
ansible_user: "{{ item.user }}"
|
|
ansible_host: "{{ item.address }}"
|
|
ansible_port: "{{ item.port }}"
|
|
ansible_private_key_file: "{{ item.identity_file }}"
|
|
ansible_ssh_extra_args: -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
|
|
loop: "{{ molecule_instance_config }}"
|
|
loop_control:
|
|
label: "{{ item.instance }}"
|
|
|
|
- hosts: molecule
|
|
tasks:
|
|
- ping:
|
|
|