Create yaml file of the zuul job vars for embedded ansible

Drop copies of the 'zuul' dict from the executor ansible into
files which can be read later by the embedded ansible.

Change-Id: I756af31f9afeaccb44498c39d0e55200d4844544
This commit is contained in:
Jonathan Rosser 2021-12-09 13:11:26 +00:00
parent e97b3980bc
commit 4566e65c45
3 changed files with 15 additions and 1 deletions

View File

@ -23,6 +23,7 @@
install_methods: install_methods:
- distro - distro
- source - source
zuul_user_vars_file: "{{ ansible_env.HOME }}/osa-job-vars.yml"
tasks: tasks:
- name: Dynamically create scenario if not set - name: Dynamically create scenario if not set
set_fact: set_fact:
@ -110,3 +111,13 @@
src: osa-gate-scenario.yml.j2 src: osa-gate-scenario.yml.j2
dest: "{{ zuul.executor.work_root }}/osa-gate-scenario.yml" dest: "{{ zuul.executor.work_root }}/osa-gate-scenario.yml"
delegate_to: localhost delegate_to: localhost
# Other playbooks can consume this vars file to access the
# Zuul job variables, see https://zuul-ci.org/docs/zuul/reference/jobs.html#user-jobs-job-variables
- name: Record the zuul user job variables for future use by embedded ansible
vars:
zuul_helper_var:
zuul: "{{ zuul }}"
template:
src: osa-job-vars.yml.j2
dest: "{{ zuul_user_vars_file }}"

View File

@ -2,4 +2,5 @@
scenario: {{ scenario | to_json }} scenario: {{ scenario | to_json }}
action: {{ action | to_json }} action: {{ action | to_json }}
install_method: {{ install_method | to_json }} install_method: {{ install_method | to_json }}
zuul_user_vars_file: {{ zuul_user_vars_file }}

View File

@ -0,0 +1,2 @@
---
{{ zuul_helper_var | to_nice_yaml(indent=2) }}