-
Notifications
You must be signed in to change notification settings - Fork 12
/
extras-create-sushy-bmh.yaml
executable file
·195 lines (175 loc) · 6.79 KB
/
extras-create-sushy-bmh.yaml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
- name: Create Libvirt VMs for sushy-tools to act as Bare Metal Hosts
hosts: localhost
connection: local
gather_facts: false
vars:
generated_asset_directory: "./generated"
### BMH CONFIGURATION ###
# cluster_name and cluster_domain will form the cluster base endpoint, eg cluster_name.cluster_domain
# Ensure the DNS A records for {api,api-int,*.apps}.cluster_name.cluster_domain exist
cluster_name: vsphere-ocp-ha
cluster_domain: kemo.labs
virtual_bmh:
- name: bmh-1
infra:
name: labRaza
# type: vsphere | libvirt
type: libvirt
vm:
cpu_cores: 4
cpu_sockets: 1
cpu_threads: 1
memory: 16384
disks:
- size: 130
name: boot
networking:
interfaces:
- name: eth0
mac_address: 54:52:00:42:69:21
# [optional] libvirt_network, if not specified, will use the network defined in the infrastructure provider credentials
libvirt_network: "lanBridge"
- name: bmh-2
infra:
name: labVMWare
# type: vsphere | libvirt
type: vsphere
vm:
cpu_cores: 4
cpu_sockets: 1
cpu_threads: 1
memory: 16384
disks:
- size: 130
name: boot
- size: 130
name: odf
networking:
interfaces:
- name: eth0
mac_address: 54:52:00:42:69:22
# [optional] vmware_network, if not specified, will use the network defined in the infrastructure provider credentials
vmware_network: "VMNetwork"
tasks:
- name: Read in variables
ansible.builtin.include_vars:
dir: vars
extensions:
- 'yaml'
- 'yml'
# =========================================================================================================================
# Preflight Infrastructure Connection Tests
# =========================================================================================================================
- name: Preflight Check - Libvirt Connection Test
when: provider.type == "libvirt"
tags:
- preflight
- conntest_libvirt
ansible.builtin.include_tasks: tasks/preflight/conntest_libvirt.yaml
loop: "{{ infrastructure_providers }}"
loop_control:
loop_var: provider
- name: Preflight Check - VMWare Connection Test
when: provider.type == "vsphere"
tags:
- preflight
- conntest_vmware
ansible.builtin.include_tasks: tasks/preflight/conntest_vmware.yaml
loop: "{{ infrastructure_providers }}"
loop_control:
loop_var: provider
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - Libvirt
# =========================================================================================================================
- name: Create the list of Libvirt targeted hosts
when: node_item.infra.type == "libvirt"
tags:
- infra_libvirt
- infra_libvirt_create_hosts_list
ansible.builtin.set_fact:
libvirt_hosts: "{{ libvirt_hosts | default([]) + [node_item] }}"
unique_libvirt_infra_providers: []
loop: "{{ virtual_bmh }}"
loop_control:
loop_var: node_item
- name: Create the list of unique Libvirt infrastructure providers
when: libvirt_hosts is defined and libvirt_hosts | length > 0
tags:
- infra_libvirt
- infra_libvirt_create_infra_list
ansible.builtin.include_tasks: tasks/infra-libvirt/get_unique_providers.yaml
loop: "{{ libvirt_hosts }}"
loop_control:
loop_var: node_item
- name: Create the Libvirt infrastructure
when:
- libvirt_hosts is defined
- libvirt_hosts | length > 0
- unique_libvirt_infra_providers | length > 0
tags:
- infra_libvirt
- infra_libvirt_create_infra
block:
- name: Perform per Libvirt Infrastructure Provider set up
ansible.builtin.include_tasks: tasks/infra-libvirt/per_provider_setup.yaml
loop: "{{ unique_libvirt_infra_providers }}"
loop_control:
loop_var: provider
label: "Libvirt Infrastructure Provider: {{ provider.name }}"
tags:
- infra_libvirt_per_provider_setup
- name: Deploy Libvirt infrastructure
ansible.builtin.include_tasks: tasks/infra-libvirt/create.yaml
loop: "{{ libvirt_hosts }}"
loop_control:
loop_var: node_item
label: "Libvirt Host: {{ node_item.name }}"
# =========================================================================================================================
# Infrastructure-specific Creation Tasks - vSphere
# =========================================================================================================================
- name: Create the list of vSphere targeted hosts
when: node_item.infra.type == "vsphere"
tags:
- infra_vsphere
- infra_vsphere_create_hosts_list
ansible.builtin.set_fact:
vsphere_hosts: "{{ vsphere_hosts | default([]) + [node_item] }}"
unique_vsphere_infra_providers: []
loop: "{{ virtual_bmh }}"
loop_control:
loop_var: node_item
- name: Create the list of unique vSphere infrastructure providers
when: vsphere_hosts is defined and vsphere_hosts | length > 0
tags:
- infra_vsphere
- infra_vsphere_create_infra_list
ansible.builtin.include_tasks: tasks/infra-vsphere/get_unique_providers.yaml
loop: "{{ vsphere_hosts }}"
loop_control:
loop_var: node_item
- name: Create the vSphere infrastructure
when:
- vsphere_hosts is defined
- vsphere_hosts | length > 0
- unique_vsphere_infra_providers | length > 0
tags:
- infra_vsphere
- infra_vsphere_create_infra
block:
- name: Perform per vSphere Infrastructure Provider set up
ansible.builtin.include_tasks: tasks/infra-vsphere/per_provider_setup.yaml
loop: "{{ unique_vsphere_infra_providers }}"
loop_control:
loop_var: provider
label: "vSphere Infrastructure Provider: {{ provider.name }}"
tags:
- infra_vsphere_per_provider_setup
- name: Deploy vSphere infrastructure
ansible.builtin.include_tasks: tasks/infra-vsphere/create.yaml
loop: "{{ vsphere_hosts }}"
loop_control:
loop_var: node_item
label: "vSphere Host: {{ node_item.name }}"
tags:
- infra_vsphere_deploy_infra