forked from openstack-k8s-operators/ci-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-ocp.yml
86 lines (76 loc) · 2.72 KB
/
deploy-ocp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
# This playbook deploy OCP, both master and workers.
# The main goal of this playbook is to be called as
# a standalone piece of a bigger job, mostly in the
# adoption context.
#
# You would typically run this playbook after the
# "create-infra.yml" one, passing the exact same parameters.
#
# Make sure you passed the needed secrets to deploy OCP!
- name: Parent scenario if needed
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
tasks:
- name: Inherit from parent scenarios if needed
ansible.builtin.include_tasks:
file: "ci/playbooks/tasks/inherit_parent_scenario.yml"
- name: Manage/generate unique ID
ansible.builtin.import_playbook: playbooks/unique-id.yml
- name: Run consistency checks
ansible.builtin.import_playbook: "playbooks/adoption/pre.yml"
- name: Prepare infrastructure datasets
ansible.builtin.import_playbook: "playbooks/adoption/infra.yml"
- name: Amend infrastructure datasets
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
tasks:
# Filter out non-ocp vms, that are created, but not started by the
# create-infra plabyook.
# The rest are created by the create-infra playbook, and managing
# them from here can cause problems in some environments, e.g
# when running each playbook from a different zuul vm
- name: Filter out non ocp vms from libvirt layout
vars:
_non_ocp_vms: >-
{{
_cifmw_libvirt_manager_layout.vms |
list | reject('match', '^ocp.*')
}}
ansible.builtin.set_fact:
_cifmw_libvirt_manager_layout: >-
{{
_cifmw_libvirt_manager_layout |
ansible.utils.remove_keys(target=_non_ocp_vms)
}}
- name: Prepare networking
ansible.builtin.import_playbook: "playbooks/adoption/network.yml"
- name: OCP cluster
hosts: "{{ cifmw_target_host | default('localhost') }}"
gather_facts: true
tasks:
- name: Deploy OCP cluster
ansible.builtin.import_role:
name: "reproducer"
tasks_from: "ocp_layout.yml"
- name: Start OCP cluster based on its overlays
ansible.builtin.import_role:
name: "libvirt_manager"
tasks_from: "deploy_layout.yml"
# Run from the hypervisor
- name: Ensure OCP cluster is stable
vars:
_auth_path: >-
{{
(
cifmw_devscripts_repo_dir,
'ocp',
cifmw_devscripts_config.cluster_name,
'auth'
) | ansible.builtin.path_join
}}
cifmw_openshift_adm_op: "stable"
cifmw_openshift_kubeconfig: >-
{{ (_auth_path, 'kubeconfig') | ansible.builtin.path_join }}
ansible.builtin.include_role:
name: openshift_adm