tripleo-ci/playbooks/tripleo-ci/run-provider.yml

73 lines
2.6 KiB
YAML

---
- hosts: all
tasks:
- name: Collect only facts of network
setup:
gather_subset:
- network
- name: Discover an IPv4 for provider job
set_fact:
provider_ip: >-
{{ hostvars[groups.all[0]].ansible_host if hostvars[groups.all[0]].ansible_host
is match("[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
else hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
- name: Discover the content-provider branch and set ci_branch
include_role:
name: build-containers
tasks_from: set_ci_branch.yml
- name: Combine override_repos with ci_branch variable
set_fact:
ci_branch: "{{ ci_branch + '-' + override_repos }}"
when: override_repos != ''
- name: Set branch variables
set_fact:
provider_job_branch: "{{ ci_branch }}"
registry_ip_address_branch: "{'{{ ci_branch }}': '{{ provider_ip }}'}"
registry_ip_address_distro: "{'{{ ansible_distribution_major_version }}': '{{ provider_ip }}'}"
- name: Check if DLRN tag was dumped in /tmp/container_build_id
stat:
path: /tmp/container_build_id
register: build_id
- name: Recover DLRN tag
when: build_id.stat.exists
block:
- name: Load file
slurp:
src: /tmp/container_build_id
register: dlrn_file
- name: Set fact for DLRN tag
set_fact:
provider_dlrn_hash_branch: "{'{{ ci_branch }}': '{{ dlrn_file['content'] | b64decode | trim }}'}"
provider_dlrn_hash_tag_branch: "{'{{ ci_branch }}': '{{ dlrn_file['content'] | b64decode | trim }}'}"
provider_dlrn_hash_distro: "{'{{ ansible_distribution_major_version }}': '{{ dlrn_file['content'] | b64decode | trim }}'}"
- name: Return Zuul data
debug:
msg: >-
Running podman registry and repository on
{{ provider_ip | default('nowhere') }}
for branch {{ ci_branch }} and DLRN tag {{ dlrn_hash|default('no tag') }}
- name: Set registry IP address
zuul_return:
data:
zuul:
pause: true
provider_dlrn_hash_branch: "{{ provider_dlrn_hash_branch|default('') }}"
provider_dlrn_hash_tag_branch: "{{ provider_dlrn_hash_tag_branch|default('') }}"
provider_job_branch: "{{ provider_job_branch }}"
registry_ip_address_branch: "{{ registry_ip_address_branch }}"
registry_ip_address_distro: "{{ registry_ip_address_distro }}"
provider_dlrn_hash_distro: "{{ provider_dlrn_hash_distro|default('') }}"
tags:
- skip_ansible_lint