
- Add STACK_NAME with zuul job - Slurp isntance config from Zuul controller Change-Id: Ifec5c21aced37557ef8fba2305e7248760b9a39f
53 lines
1.6 KiB
YAML
53 lines
1.6 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 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 }}"
|
|
environment:
|
|
ATMOSPHERE_STACK_NAME: "atmosphere-{{ zuul.build }}"
|
|
|
|
- name: Grab the Molecule instance configuration
|
|
slurp:
|
|
src: "{{ ansible_user_dir }}/.cache/molecule/{{ zuul.project.short_name }}/default/instance_config.yml"
|
|
register: _molecule_instance_config
|
|
|
|
- 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['content'] | b64decode | from_yaml }}"
|
|
loop_control:
|
|
label: "{{ item.instance }}"
|
|
|
|
- hosts: molecule
|
|
tasks:
|
|
- ping:
|
|
|