Skip to content

Commit acd3670

Browse files
committed
[reproducer] Add secret files as argument for deploy architecture
On executing nested Ansible, some variables like: 'cifmw_registry_token' are not redirected, which is causing an issue in later tasks, which are operating on those variables and if it is undefine, it raise an issue. To satisfy nested Ansible execution, provide necessary variables. Also include hypervisor name as it can be a missing variable, due jobs already bootstrapped by ZIronic does not require to have that variable, which in some tasks is necessary. Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
1 parent 13bad13 commit acd3670

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

reproducer.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,27 @@
138138
name: reproducer
139139
tasks_from: overwrite_zuul_vars.yml
140140

141+
# NOTE(dpawlik): Since we use ZIronic, some variables are not
142+
# redirected to nested ansible execution - they needs to be
143+
# included on executing host - controller-0.
144+
- name: Compute additional deploy_architecture_args with secrets
145+
when:
146+
- not cifmw_deploy_reproducer_env | default(true) | bool
147+
vars:
148+
basic_secret_files:
149+
- "{{ ansible_user_dir }}/secrets/registry_token_creds.yaml"
150+
ansible.builtin.include_role:
151+
name: reproducer
152+
tasks_from: compute_additional_args.yml
153+
loop: "{{ cifmw_deploy_architecture_secret_files | default(basic_secret_files) }}"
154+
loop_control:
155+
loop_var: secret_file
156+
157+
- name: Print final cifmw_deploy_architecture_args
158+
ansible.builtin.debug:
159+
msg: >
160+
Current cifmw_deploy_architecture_args {{ cifmw_deploy_architecture_args | default('') }}
161+
141162
- name: Run deployment if instructed to
142163
when:
143164
- cifmw_deploy_architecture | default(false) | bool
@@ -146,7 +167,10 @@
146167
poll: 20
147168
delegate_to: controller-0
148169
ansible.builtin.command:
149-
cmd: "$HOME/deploy-architecture.sh {{ cifmw_deploy_architecture_args | default('') }}"
170+
cmd: >
171+
$HOME/deploy-architecture.sh
172+
-e hypervisor="{{ hypervisor }}"
173+
{{ cifmw_deploy_architecture_args | default('') }}
150174
151175
- name: Run post deployment if instructed to
152176
when:

roles/cifmw_setup/tasks/bootstrap.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
role: discover_latest_image
6060

6161
- name: Create artifacts with custom params
62-
when:
63-
- cifmw_deploy_reproducer_env | default(true) | bool
6462
tags:
6563
- always
6664
ansible.builtin.copy:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: "Checking if file exists {{ secret_file }}"
3+
ansible.builtin.stat:
4+
path: "{{ secret_file }}"
5+
register: _current_file
6+
7+
- name: Add secret file into cifmw_deploy_architecture_args when exists
8+
when: _current_file.stat.exists
9+
ansible.builtin.set_fact:
10+
cifmw_deploy_architecture_args: >
11+
{{ cifmw_deploy_architecture_args | default('') }}
12+
-e @{{ secret_file }}

0 commit comments

Comments
 (0)