Skip to content

Commit 725977a

Browse files
danpawlikevallesp
authored andcommitted
Use role instead of playbooks - 02-infra.yml
It is continuation of simplification job execution [1]. [1] #2929 Signed-off-by: Daniel Pawlik <dpawlik@redhat.com>
1 parent efef0e1 commit 725977a

6 files changed

Lines changed: 189 additions & 6 deletions

File tree

ci/playbooks/kuttl/deploy-deps.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,38 @@
2121
name: 'install_yamls_makes'
2222
tasks_from: 'make_download_tools'
2323

24-
- name: Run ci_framework infra playbook
25-
ansible.builtin.import_playbook: "../../../playbooks/02-infra.yml"
24+
- name: Run pre_infra hooks
25+
vars:
26+
step: pre_infra
27+
ansible.builtin.import_role:
28+
name: run_hook
29+
30+
- name: Prepare host virtualization
31+
hosts: "{{ ('virthosts' in groups) | ternary('virthosts', cifmw_target_host | default('localhost') ) }}"
32+
tasks:
33+
- name: Run prepare host virtualization
34+
vars:
35+
step: pre_infra
36+
ansible.builtin.import_role:
37+
name: cifmw_setup
38+
tasks_from: host_virtualization.yml
39+
tags:
40+
- infra
2641

2742
- name: Build dataset hook
2843
hosts: "{{ cifmw_target_host | default('localhost') }}"
2944
gather_facts: false
3045
connection: local
3146
tasks:
47+
- name: Prepare the platform
48+
vars:
49+
step: pre_infra
50+
ansible.builtin.import_role:
51+
name: cifmw_setup
52+
tasks_from: infra.yml
53+
tags:
54+
- infra
55+
3256
- name: Load parameters
3357
ansible.builtin.include_vars:
3458
dir: "{{ item }}"

deploy-edpm.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,37 @@
2323
name: cifmw_setup
2424
tasks_from: bootstrap.yml
2525

26-
- name: Import infra entrypoint playbook
27-
ansible.builtin.import_playbook: playbooks/02-infra.yml
28-
tags:
29-
- infra
26+
- name: Run pre_infra hooks
27+
vars:
28+
step: pre_infra
29+
ansible.builtin.import_role:
30+
name: run_hook
31+
tags:
32+
- infra
33+
34+
- name: Prepare host virtualization
35+
hosts: "{{ ('virthosts' in groups) | ternary('virthosts', cifmw_target_host | default('localhost') ) }}"
36+
tasks:
37+
- name: Run prepare host virtualization
38+
vars:
39+
step: pre_infra
40+
ansible.builtin.import_role:
41+
name: cifmw_setup
42+
tasks_from: host_virtualization.yml
43+
tags:
44+
- infra
45+
46+
- name: Run cifmw_setup infra.yml
47+
hosts: "{{ cifmw_target_host | default('localhost') }}"
48+
tasks:
49+
- name: Prepare the platform
50+
vars:
51+
step: pre_infra
52+
ansible.builtin.import_role:
53+
name: cifmw_setup
54+
tasks_from: infra.yml
55+
tags:
56+
- infra
3057

3158
- name: Import package build playbook
3259
ansible.builtin.import_playbook: playbooks/03-build-packages.yml

playbooks/01-bootstrap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
2+
#
23
# NOTE: Playbook migrated to: cifmw_setup/tasks/bootstrap.yml.
4+
# DO NOT EDIT THAT PLAYBOOK. IT WOULD BE REMOVED IN NEAR FUTURE.
5+
#
36
- name: Bootstrap playbook
47
hosts: "{{ cifmw_target_host | default('localhost') }}"
58
gather_facts: true

playbooks/02-infra.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
---
2+
#
3+
# NOTE: Playbook migrated to: cifmw_setup/tasks/infra.yml.
4+
# DO NOT EDIT THAT PLAYBOOK. IT WOULD BE REMOVED IN NEAR FUTURE.
5+
#
26
- name: Run pre_infra hooks
37
hosts: "{{ cifmw_target_host | default('localhost') }}"
48
gather_facts: false
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
- name: Load parameters files
3+
ansible.builtin.include_vars:
4+
dir: "{{ cifmw_basedir }}/artifacts/parameters"
5+
6+
- name: Ensure libvirt is present/configured
7+
when:
8+
- cifmw_use_libvirt is defined
9+
- cifmw_use_libvirt | bool
10+
ansible.builtin.include_role:
11+
name: libvirt_manager
12+
13+
- name: Perpare OpenShift provisioner node
14+
when:
15+
- cifmw_use_opn is defined
16+
- cifmw_use_opn | bool
17+
ansible.builtin.include_role:
18+
name: openshift_provisioner_node

roles/cifmw_setup/tasks/infra.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
- name: Load parameters files
3+
ansible.builtin.include_vars:
4+
dir: "{{ cifmw_basedir }}/artifacts/parameters"
5+
6+
- name: Load Networking Environment Definition
7+
vars:
8+
cifmw_networking_mapper_assert_env_load: false
9+
ansible.builtin.import_role:
10+
name: networking_mapper
11+
tasks_from: load_env_definition.yml
12+
13+
- name: Deploy OCP using Hive
14+
when:
15+
- cifmw_use_hive is defined
16+
- cifmw_use_hive | bool
17+
ansible.builtin.include_role:
18+
name: hive
19+
20+
- name: Prepare CRC
21+
when:
22+
- cifmw_use_crc is defined
23+
- cifmw_use_crc | bool
24+
ansible.builtin.include_role:
25+
name: rhol_crc
26+
27+
- name: Deploy OpenShift cluster using dev-scripts
28+
when:
29+
- cifmw_use_devscripts is defined
30+
- cifmw_use_devscripts | bool
31+
ansible.builtin.include_role:
32+
name: devscripts
33+
34+
- name: Login into Openshift cluster
35+
tags:
36+
- always
37+
vars:
38+
cifmw_openshift_login_force_refresh: true
39+
ansible.builtin.import_role:
40+
name: openshift_login
41+
42+
- name: Setup Openshift cluster
43+
ansible.builtin.import_role:
44+
name: openshift_setup
45+
46+
- name: Deploy Observability operator.
47+
when:
48+
- cifmw_deploy_obs is defined
49+
- cifmw_deploy_obs | bool
50+
ansible.builtin.include_role:
51+
name: openshift_obs
52+
53+
- name: Deploy Metal3 BMHs
54+
when:
55+
- cifmw_config_bmh is defined
56+
- cifmw_config_bmh | bool
57+
ansible.builtin.include_role:
58+
name: deploy_bmh
59+
60+
- name: Install certmanager operator role
61+
when:
62+
- cifmw_config_certmanager is defined
63+
- cifmw_config_certmanager | bool
64+
ansible.builtin.include_role:
65+
name: cert_manager
66+
67+
- name: Configure hosts networking using nmstate
68+
when:
69+
- cifmw_config_nmstate is defined
70+
- cifmw_config_nmstate | bool
71+
ansible.builtin.include_role:
72+
name: ci_nmstate
73+
74+
- name: Configure multus networks
75+
when:
76+
- cifmw_config_multus | default(false) | bool
77+
ansible.builtin.include_role:
78+
name: ci_multus
79+
80+
- name: Deploy Sushy Emulator and configure controller as hypervisor
81+
when:
82+
- cifmw_enable_virtual_baremetal_support | default(false) | bool
83+
block:
84+
- name: Deploy Sushy Emulator service pod
85+
vars:
86+
cifmw_sushy_emulator_hypervisor_address: "{{ hostvars['controller'].ansible_host }}"
87+
cifmw_sushy_emulator_hypervisor_target: controller
88+
cifmw_sushy_emulator_install_type: ocp
89+
ansible.builtin.include_role:
90+
name: sushy_emulator
91+
92+
- name: Setup Libvirt on controller
93+
ansible.builtin.include_role:
94+
name: libvirt_manager
95+
96+
- name: Prepare container package builder
97+
when:
98+
- cifmw_pkg_build_list is defined
99+
- cifmw_pkg_build_list | length > 0
100+
ansible.builtin.include_role:
101+
name: pkg_build
102+
103+
- name: Run post_infra hooks
104+
vars:
105+
step: post_infra
106+
ansible.builtin.import_role:
107+
name: run_hook

0 commit comments

Comments
 (0)