Skip to content

Commit 712ef7d

Browse files
danpawlikdasm
authored andcommitted
Use role instead of playbooks - 01-bootstrap.yml
Most of the playbooks which are executed inside the nested Ansible (Ansible inside the Ansible) does not need to be in playbook, it can be in a simple role. The previous CI execution for 01-bootstrap.yml file was: Zuul CI -> Ansible command -> Ansible playbook -> import playbook -> import playbook With this change would be one layer less: Zuul CI -> Ansible command -> Ansible playbook -> cifmw_setup role Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
1 parent b54e797 commit 712ef7d

16 files changed

Lines changed: 141 additions & 67 deletions

File tree

ci/playbooks/content_provider/content_provider.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
- name: Bootstrap step
3-
ansible.builtin.import_playbook: >-
4-
{{
5-
[
6-
ansible_user_dir,
7-
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
8-
'playbooks',
9-
'01-bootstrap.yml'
10-
] | ansible.builtin.path_join
11-
}}
2+
- name: Bootstrap playbook
3+
hosts: "{{ cifmw_target_host | default('localhost') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
1210

1311
- name: "Run ci/playbooks/content_provider/content_provider.yml"
1412
hosts: "{{ cifmw_target_host | default('localhost') }}"

ci/playbooks/edpm_build_images/edpm_image_builder.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
- name: Boostrap node
3-
ansible.builtin.import_playbook: >-
4-
{{
5-
[
6-
ansible_user_dir,
7-
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
8-
'playbooks',
9-
'01-bootstrap.yml'
10-
] | ansible.builtin.path_join
11-
}}
2+
- name: Bootstrap playbook
3+
hosts: "{{ cifmw_target_host | default('localhost') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
1210

1311
- name: "Run ci/playbooks/edpm_build_images/edpm_image_builder.yml"
1412
hosts: "{{ cifmw_zuul_target_host | default('localhost') }}"

ci/playbooks/kuttl/deploy-deps.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
2-
- name: Run ci_framework bootstrap playbook
3-
ansible.builtin.import_playbook: "../../../playbooks/01-bootstrap.yml"
2+
- name: Bootstrap playbook
3+
hosts: "{{ cifmw_target_host | default('localhost') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
410

511
- hosts: "{{ cifmw_target_host | default('localhost') }}"
612
name: Install dev tools

ci/playbooks/kuttl/e2e-kuttl.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
- name: Bootstrap step
3-
ansible.builtin.import_playbook: >-
4-
{{
5-
[
6-
ansible_user_dir,
7-
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
8-
'playbooks',
9-
'01-bootstrap.yml'
10-
] | ansible.builtin.path_join
11-
}}
2+
- name: Bootstrap playbook
3+
hosts: "{{ cifmw_target_host | default('localhost') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
1210

1311
- name: Install deps and prepare for KUTTL run
1412
hosts: "{{ cifmw_target_host | default('localhost') }}"

ci/playbooks/meta_content_provider/meta_content_provider.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
---
2-
- name: Bootstrap step
3-
ansible.builtin.import_playbook: >-
4-
{{
5-
[
6-
ansible_user_dir,
7-
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
8-
'playbooks',
9-
'01-bootstrap.yml'
10-
] | ansible.builtin.path_join
11-
}}
12-
132
- name: Run ci/playbooks/meta_content_provider/meta_content_provider.yml
143
hosts: "{{ cifmw_target_host | default('localhost') }}"
154
gather_facts: true
165
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
10+
1711
- name: Install necessary dependencies
1812
ansible.builtin.include_role:
1913
name: 'install_yamls_makes'

ci/playbooks/tcib/tcib.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
2-
- name: Bootstrap step
3-
ansible.builtin.import_playbook: >-
4-
{{
5-
[
6-
ansible_user_dir,
7-
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
8-
'playbooks',
9-
'01-bootstrap.yml'
10-
] | ansible.builtin.path_join
11-
}}
2+
- name: Bootstrap playbook
3+
hosts: "{{ cifmw_target_host | default('localhost') }}"
4+
gather_facts: true
5+
tasks:
6+
- name: Run bootstrap
7+
ansible.builtin.import_role:
8+
name: cifmw_setup
9+
tasks_from: bootstrap.yml
1210

1311
- name: "Run ci/playbooks/tcib/tcib.yml"
1412
hosts: "{{ cifmw_target_host | default('localhost') }}"

deploy-edpm.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
ansible.builtin.include_tasks:
1919
file: "ci/playbooks/tasks/inherit_parent_scenario.yml"
2020

21-
- name: Bootstrap step
22-
ansible.builtin.import_playbook: playbooks/01-bootstrap.yml
21+
- name: Run bootstrap
22+
ansible.builtin.import_role:
23+
name: cifmw_setup
24+
tasks_from: bootstrap.yml
2325

2426
- name: Import infra entrypoint playbook
2527
ansible.builtin.import_playbook: playbooks/02-infra.yml

hooks/playbooks/ceph-deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# Since the hook injects the ansible.cfg in the ansible-playbook command,
1515
# we therefore should know where to look for the install_yamls_makes role.
1616
# For the records, this role is generated in the 01-bootstrap.yml playbook
17+
# (migrated to: roles/cifmw_setup/tasks/bootstrap.yml)
1718
# by leveraging the install_yamls role and related modules, especially
1819
# the generate_make_tasks.
1920
# And we can pass down the cifmw_make_ceph_environment set in the

playbooks/01-bootstrap.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
# NOTE: Playbook migrated to: cifmw_setup/tasks/bootstrap.yml.
13
- name: Bootstrap playbook
24
hosts: "{{ cifmw_target_host | default('localhost') }}"
35
gather_facts: true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
ansible_user_dir: "{{ lookup('env', 'HOME') }}"

0 commit comments

Comments
 (0)