Skip to content

Commit 1baf7b3

Browse files
committed
[multiple] Changes to run playbooks to zuul host
This adds an option to run playbooks on zuul host rather than controller-0 and converts minor update job to use it. Signed-off-by: rabi <ramishra@redhat.com>
1 parent 33d5122 commit 1baf7b3

11 files changed

Lines changed: 1168 additions & 63 deletions

File tree

ci/playbooks/edpm/update.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
# When cifmw_run_on_zuul_host is true, this playbook directly imports update-edpm.yml
3+
# instead of running nested ansible-playbook commands.
24
- name: "Run ci/playbooks/edpm/update.yml"
35
hosts: "{{ cifmw_zuul_target_host | default('all') }}"
46
gather_facts: true
@@ -15,7 +17,45 @@
1517
path: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"
1618
register: edpm_file
1719

18-
- name: Run Podified EDPM update
20+
- name: Load parameters for direct execution
21+
when: cifmw_run_on_zuul_host | default(false) | bool
22+
block:
23+
- name: Load group vars
24+
ansible.builtin.include_vars:
25+
file: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars/all.yml"
26+
ignore_errors: true
27+
28+
- name: Load scenario files
29+
ansible.builtin.include_vars:
30+
file: "{{ item }}"
31+
loop:
32+
- "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/scenarios/centos-9/base.yml"
33+
- "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/scenarios/centos-9/edpm_ci.yml"
34+
ignore_errors: true
35+
36+
- name: Load edpm-ansible.yml if exists
37+
when: edpm_file.stat.exists
38+
ansible.builtin.include_vars:
39+
file: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"
40+
ignore_errors: true
41+
42+
- name: Load all parameters from parameters directory
43+
vars:
44+
provided_dir: "{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters"
45+
ansible.builtin.include_role:
46+
name: cifmw_helpers
47+
tasks_from: var_dir.yml
48+
49+
- name: Set update_playbook_run fact
50+
ansible.builtin.set_fact:
51+
update_playbook_run: true
52+
53+
- name: Directly import update-edpm.yml playbook (zuul host execution)
54+
when: cifmw_run_on_zuul_host | default(false) | bool
55+
ansible.builtin.import_playbook: update-edpm.yml
56+
57+
- name: Run Podified EDPM update via nested ansible-playbook (controller-0 execution)
58+
when: not (cifmw_run_on_zuul_host | default(false) | bool)
1959
ansible.builtin.command:
2060
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
2161
cmd: >-

ci/playbooks/edpm_baremetal_update/run.yml

Lines changed: 78 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -84,44 +84,84 @@
8484
8585
- name: Override operator build output with pre-update index image for Phase 1
8686
ansible.builtin.set_fact:
87-
cifmw_operator_build_output_pre_update: >-
88-
{{
89-
{
90-
'cifmw_operator_build_output': {
91-
'operators': {
92-
'openstack-operator': {
93-
'image_catalog': cifmw_minor_update_pre_update_index_image
94-
}
95-
}
96-
}
97-
}
98-
}}
87+
cifmw_operator_build_output:
88+
operators:
89+
openstack-operator:
90+
image_catalog: "{{ cifmw_minor_update_pre_update_index_image }}"
9991

100-
- name: Phase 1 - Deploy with pre-update index image using deploy-edpm.yml
92+
- name: Load parameters for direct execution
10193
block:
102-
- name: Write pre-update operator build output to temporary file
103-
ansible.builtin.copy:
104-
dest: "{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml"
105-
content: "{{ cifmw_operator_build_output_pre_update | to_nice_yaml }}"
106-
mode: "0644"
94+
- name: Load group vars
95+
block:
96+
- name: Read group vars file
97+
ansible.builtin.slurp:
98+
src: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars/all.yml"
99+
delegate_to: localhost
100+
register: _group_vars_content
101+
102+
- name: Set group vars as facts
103+
when: "'content' in _group_vars_content"
104+
ansible.builtin.set_fact:
105+
"{{ item.key }}": "{{ item.value }}"
106+
cacheable: true
107+
loop: "{{ _group_vars_content['content'] | b64decode | from_yaml | dict2items }}"
108+
loop_control:
109+
loop_var: item
110+
111+
- name: Load scenario files
112+
loop:
113+
- "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/scenarios/centos-9/base.yml"
114+
- "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/scenarios/centos-9/edpm_baremetal_deployment_ci.yml"
115+
loop_control:
116+
loop_var: scenario_file
117+
block:
118+
- name: Read scenario file
119+
ansible.builtin.slurp:
120+
src: "{{ scenario_file }}"
121+
delegate_to: localhost
122+
register: _scenario_file
123+
124+
- name: Set scenario vars as facts
125+
when: "'content' in _scenario_file"
126+
ansible.builtin.set_fact:
127+
"{{ fact_item.key }}": "{{ fact_item.value }}"
128+
cacheable: true
129+
loop: "{{ _scenario_file['content'] | b64decode | from_yaml | dict2items }}"
130+
loop_control:
131+
loop_var: fact_item
132+
133+
- name: Load edpm-ansible.yml if exists
134+
when: edpm_file.stat.exists
135+
block:
136+
- name: Read edpm-ansible.yml file
137+
ansible.builtin.slurp:
138+
src: "{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml"
139+
delegate_to: localhost
140+
register: _edpm_content
141+
142+
- name: Set edpm vars as facts
143+
when: "'content' in _edpm_content"
144+
ansible.builtin.set_fact:
145+
"{{ item.key }}": "{{ item.value }}"
146+
cacheable: true
147+
loop: "{{ _edpm_content['content'] | b64decode | from_yaml | dict2items }}"
148+
loop_control:
149+
loop_var: item
150+
151+
- name: Load all parameters from parameters directory
152+
vars:
153+
provided_dir: "{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters"
154+
ansible.builtin.include_role:
155+
name: cifmw_helpers
156+
tasks_from: var_dir.yml
157+
apply:
158+
delegate_to: localhost
159+
become: false
160+
gather_facts: false
161+
162+
- name: Set cifmw_prepare_openstackversion fact
163+
ansible.builtin.set_fact:
164+
cifmw_prepare_openstackversion: false
107165

108-
- name: Perform Podified and EDPM deployment on compute nodes with virtual baremetal (pre-update)
109-
ansible.builtin.command:
110-
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
111-
cmd: >-
112-
ansible-playbook deploy-edpm.yml
113-
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
114-
-e @group_vars/all.yml
115-
-e @scenarios/centos-9/base.yml
116-
-e @scenarios/centos-9/edpm_baremetal_deployment_ci.yml
117-
{%- if edpm_file.stat.exists %}
118-
-e @{{ ansible_user_dir }}/ci-framework-data/artifacts/edpm-ansible.yml
119-
{%- endif %}
120-
{%- if cifmw_extras is defined %}
121-
{%- for extra_var in cifmw_extras %}
122-
-e "{{ extra_var }}"
123-
{%- endfor %}
124-
{%- endif %}
125-
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"
126-
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/operator_build_output_pre_update.yml"
127-
-e "cifmw_prepare_openstackversion=false"
166+
- name: Phase 1 - Deploy with pre-update index image using deploy-edpm.yml
167+
ansible.builtin.import_playbook: ../../../deploy-edpm.yml

ci/playbooks/edpm_baremetal_update/update.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# CI playbook orchestrator for OpenStack minor version updates.
3-
# This playbook runs on the controller (cifmw_zuul_target_host) and orchestrates
4-
# the update by calling update-edpm.yml on the target host (cifmw_target_host).
3+
# This playbook runs on the zuul host (cifmw_zuul_target_host) and orchestrates
4+
# the update by calling the update role's update_variant_ci.yml task (no nested ansible-playbook).
55
# This playbook depends on content provider variables from CI jobs.
66
# This is Phase 2 of the baremetal update workflow and should be called
77
# sequentially after run.yml (Phase 1).
@@ -39,14 +39,14 @@
3939
mode: "0644"
4040
when: cifmw_minor_update_index_image is defined
4141

42-
- name: Run update-edpm.yml on target host
43-
ansible.builtin.command:
44-
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
45-
cmd: >-
46-
ansible-playbook ci/playbooks/edpm_baremetal_update/update-edpm.yml
47-
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
48-
-e @group_vars/all.yml
49-
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"
50-
{%- if cifmw_minor_update_index_image is defined %}
51-
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/minor_update_index_image.yml"
52-
{%- endif %}
42+
- name: Load all parameters from parameters directory
43+
vars:
44+
provided_dir: "{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters"
45+
ansible.builtin.include_role:
46+
name: cifmw_helpers
47+
tasks_from: var_dir.yml
48+
49+
- name: Run minor update using update role
50+
ansible.builtin.include_role:
51+
name: update
52+
tasks_from: update_variant_ci.yml

reproducer.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,46 @@
9494
name: firewalld
9595
state: restarted
9696

97-
- name: Run deployment if instructed to
97+
- name: Run deployment if instructed to (controller-0 legacy mode)
9898
when:
9999
- cifmw_deploy_architecture | default(false) | bool
100+
- not (cifmw_run_on_zuul_host | default(false) | bool)
100101
no_log: "{{ cifmw_nolog | default(true) | bool }}"
101102
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
102103
poll: 20
103104
delegate_to: controller-0
104105
ansible.builtin.command:
105106
cmd: "$HOME/deploy-architecture.sh {{ cifmw_deploy_architecture_args | default('') }}"
106107

107-
- name: Run post deployment if instructed to
108+
- name: Run deployment if instructed to (zuul host direct execution)
109+
when:
110+
- cifmw_deploy_architecture | default(false) | bool
111+
- cifmw_run_on_zuul_host | default(false) | bool
112+
no_log: "{{ cifmw_nolog | default(true) | bool }}"
113+
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
114+
poll: 20
115+
ansible.builtin.command:
116+
cmd: "$HOME/deploy-architecture.sh {{ cifmw_deploy_architecture_args | default('') }}"
117+
118+
- name: Run post deployment if instructed to (controller-0 legacy mode)
108119
when:
109120
- cifmw_deploy_architecture | default(false) | bool
110121
- cifmw_post_deployment | default(true) | bool
122+
- not (cifmw_run_on_zuul_host | default(false) | bool)
111123
no_log: "{{ cifmw_nolog | default(true) | bool }}"
112124
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
113125
poll: 20
114126
delegate_to: controller-0
115127
ansible.builtin.command:
116128
cmd: "$HOME/post_deployment.sh {{ cifmw_post_deploy_args | default('') }}"
129+
130+
- name: Run post deployment if instructed to (zuul host direct execution)
131+
when:
132+
- cifmw_deploy_architecture | default(false) | bool
133+
- cifmw_post_deployment | default(true) | bool
134+
- cifmw_run_on_zuul_host | default(false) | bool
135+
no_log: "{{ cifmw_nolog | default(true) | bool }}"
136+
async: "{{ 7200 + cifmw_test_operator_timeout | default(3600) }}" # 2h should be enough to deploy EDPM and rest for tests.
137+
poll: 20
138+
ansible.builtin.command:
139+
cmd: "$HOME/post_deployment.sh {{ cifmw_post_deploy_args | default('') }}"

roles/reproducer/defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ cifmw_reproducer_validate_network_host: "controller-0.utility"
5050
cifmw_reproducer_validate_ocp_layout: true
5151

5252
cifmw_reproducer_ironic_node_name_prefix:
53+
54+
# Enable zuul host direct execution (Phase 1-3: parallel with controller-0, Phase 4: required)
55+
# When true, playbooks run directly on zuul host instead of delegating to controller-0 VM
56+
# This eliminates nested ansible-playbook execution
57+
cifmw_run_on_zuul_host: false

0 commit comments

Comments
 (0)