forked from karmab/kcli-ztp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-config.yaml
227 lines (227 loc) · 8.92 KB
/
install-config.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
{% import 'static_network/config.j2' as static_network %}
{% set baremetal_prefix = baremetal_cidr.split('/')[1] %}
{% set baremetal_gateway = static_baremetal_gateway or baremetal_cidr|network_ip(1 if lab else -2) %}
{% set baremetal_dns = static_baremetal_dns or baremetal_gateway %}
{% set nic = 'enp1s0' if virtual_protocol == 'redfish' or not provisioning_enable else 'ens3' %}
{% if api_ip != None and ':' in api_ip %}
{% set ipv6 = True %}
{% else %}
{% set ipv6 = False %}
{% endif %}
{% if virtual_masters %}
{% set extra_masters = [] %}
{% for num in range(0, virtual_masters_number) %}
{% if virtual_masters_static_network and baremetal_ips|length > num %}
{% set new_master = {'ip': baremetal_ips[num]} %}
{% else %}
{% set new_master = {} %}
{% endif %}
{% do extra_masters.append(new_master) %}
{% endfor %}
{% set masters = extra_masters + masters %}
{% endif %}
{% if virtual_workers and virtual_workers_deploy %}
{% set extra_workers = [] %}
{% for num in range(0, virtual_workers_number) %}
{% if virtual_workers_static_network and baremetal_ips|length > virtual_masters_number + num %}
{% set new_worker = {'ip': baremetal_ips[virtual_masters_number + num]} %}
{% else %}
{% set new_worker = {} %}
{% endif %}
{% do extra_workers.append(new_worker) %}
{% endfor %}
{% set workers = extra_workers + workers %}
{% endif %}
{% if provisioning_enable %}
{% set virtual_masters_bootmac_prefix = virtual_masters_mac_prefix %}
{% set virtual_workers_bootmac_prefix = virtual_workers_mac_prefix %}
{% else %}
{% set virtual_masters_bootmac_prefix = virtual_masters_baremetal_mac_prefix %}
{% set virtual_workers_bootmac_prefix = virtual_workers_baremetal_mac_prefix %}
{% endif %}
{% set cluster_network_ipv6 = {"cidr": "fd01::/48", "hostPrefix": 64} %}
{% set cluster_network_ipv4 = {"cidr": "10.132.0.0/14", "hostPrefix": 23} %}
{% set service_network_ipv6 = ["fd02::/112"] %}
{% set service_network_ipv4 = ["172.30.0.0/16"] %}
{% set machine_networks = [baremetal_cidr] %}
{% if dualstack|default(False) %}
{% set machine_networks = [baremetal_cidr] + [dualstack_cidr] %}
{% set cluster_networks = [cluster_network_ipv4] + [cluster_network_ipv6] %}
{% set service_networks = service_network_ipv4 + service_network_ipv6 %}
{% elif ipv6 %}
{% set cluster_networks = [cluster_network_ipv6] %}
{% set service_networks = service_network_ipv6 %}
{% else %}
{% set cluster_networks = [cluster_network_ipv4] %}
{% set service_networks = service_network_ipv4 %}
{% endif %}
apiVersion: v1
{% if fips %}
fips: True
{% endif %}
baseDomain: {{ domain }}
{% if http_proxy != None %}
proxy:
httpProxy: {{ 'http://' + http_proxy if 'http' not in http_proxy else http_proxy }}
httpsProxy: {{ 'http://' + http_proxy if 'http' not in http_proxy else http_proxy }}
{% if no_proxy != None %}
noProxy: {{ no_proxy }}
{% else %}
noProxy: {{ baremetal_cidr }}
{% endif %}
{% endif %}
networking:
networkType: {{ network_type }}
machineNetwork:
{% for network in machine_networks %}
- cidr: {{ network }}
{% endfor %}
clusterNetwork:
{% for network in cluster_networks %}
- cidr: {{ network['cidr'] }}
hostPrefix: {{ network['hostPrefix'] }}
{% endfor %}
serviceNetwork:
{% for network in service_networks %}
- {{ network }}
{% endfor %}
metadata:
name: {{ cluster }}
compute:
- name: worker
replicas: {{ workers|length }}
controlPlane:
name: master
replicas: {{ masters|length }}
platform:
baremetal:
apiVIP: {{ api_ip }}
ingressVIP: {{ ingress_ip }}
{% if not provisioning_enable %}
provisioningNetwork: "Disabled"
{% if baremetal_noprovisioning_ip != None %}
provisioningHostIP: {{ baremetal_noprovisioning_ip }}
{% endif %}
{% if baremetal_noprovisioning_bootstrap_ip != None %}
bootstrapProvisioningIP: {{ baremetal_noprovisioning_bootstrap_ip }}
{% endif %}
{% else %}
provisioningBridge: {{ provisioning_net }}
{% if virtual_masters %}
provisioningNetworkInterface: {{ 'enp1s0' if virtual_protocol == 'redfish' else 'ens3' }}
{% else %}
provisioningNetworkInterface: {{ provisioning_interface }}
{% endif %}
{% endif %}
externalBridge: {{ baremetal_net }}
libvirtURI: qemu+ssh://{{ 'root' if config_user == 'apache' else config_user }}@{{ config_host if config_host != '127.0.0.1' else baremetal_net|local_ip(true) }}/system
{% if provisioning_bootstrap_mac != None %}
provisioningMACAddress: {{ provisioning_bootstrap_mac }}
{% endif %}
{% if baremetal_bootstrap_mac != None %}
externalMACAddress: {{ baremetal_bootstrap_mac }}
{% endif %}
hosts:
{% for master in masters %}
{% set num = loop.index0|string %}
- name: {{ cluster }}-master-{{ num }}
role: master
bmc:
{% if 'redfish_address' in master %}
disableCertificateVerification: True
{% if 'redfish' in master['redfish_address'] or 'idrac' in master['redfish_address'] %}
address: {{ master['redfish_address'] }}
{% elif master['model']|default(model) in ['hpe', 'supermicro'] %}
address: redfish-virtualmedia://{{ master['redfish_address'] }}/redfish/v1/Systems/1
{% else %}
address: idrac-virtualmedia://{{ master['redfish_address'] }}/redfish/v1/Systems/System.Embedded.1
{% endif %}
{% else %}
address: ipmi://{{ master['ipmi_address'] | default('DONTCHANGEME:623' + num)}}
{% endif %}
username: {{ master['bmc_user']|default(bmc_user) }}
password: {{ master['bmc_password']|default(bmc_password) }}
{% if 'boot_mode' in master %}
bootMode: {{ master['boot_mode'] }}
{% endif %}
{% if 'provisioning_mac' in master %}
bootMACAddress: {{ master['provisioning_mac'] }}
{% elif not provisioning_enable and baremetal_macs and baremetal_macs|length > num|int %}
bootMACAddress: {{ baremetal_macs[num|int] }}
{% else %}
bootMACAddress: {{ virtual_masters_bootmac_prefix + ":" + "%02.d" | format(num|int + 1)| string }}
{% endif %}
{% if 'disk' in master %}
rootDeviceHints:
deviceName: "/dev/{{ master['disk'] | basename }}"
{% endif %}
{% if 'ip' in master %}
networkConfig: |
{{ static_network.config(master['ip'], baremetal_prefix, master['gateway']|default(baremetal_gateway), master['dns']|default(baremetal_dns), cluster, domain, master['nic']|default(nic)) }}
{% elif 'network_config' in master %}
networkConfig: {{ master['network_config']|replace('\n', '\n ') }}
{% endif %}
{% endfor %}
{% for worker in workers %}
{% set num = loop.index0|string %}
- name: {{ cluster }}-worker-{{ num }}
role: worker
bmc:
{% if 'redfish_address' in worker %}
disableCertificateVerification: True
{% if 'redfish' in worker['redfish_address'] or 'idrac' in worker['redfish_address'] %}
address: {{ worker['redfish_address'] }}
{% elif worker['model']|default(model) in ['hpe', 'supermicro'] %}
address: redfish-virtualmedia://{{ worker['redfish_address'] }}/redfish/v1/Systems/1
{% else %}
address: idrac-virtualmedia://{{ worker['redfish_address'] }}/redfish/v1/Systems/System.Embedded.1
{% endif %}
{% else %}
address: ipmi://{{ worker['ipmi_address'] | default('DONTCHANGEME:624' + num)}}
{% endif %}
username: {{ worker['bmc_user']|default(bmc_user) }}
password: {{ worker['bmc_password']|default(bmc_password) }}
{% if 'boot_mode' in worker %}
bootMode: {{ worker['boot_mode'] }}
{% endif %}
{% if 'provisioning_mac' in worker %}
bootMACAddress: {{ worker ['provisioning_mac'] }}
{% elif not provisioning_enable and baremetal_macs and baremetal_macs|length > virtual_masters_number + num|int %}
bootMACAddress: {{ baremetal_macs[virtual_masters_number + num|int] }}
{% else %}
bootMACAddress: {{ virtual_workers_bootmac_prefix + ":" + "%02.d" | format(num|int + 1)| string }}
{% endif %}
hardwareProfile: unknown
{% if 'disk' in worker %}
rootDeviceHints:
deviceName: "/dev/{{ worker['disk'] | basename }}"
{% endif %}
{% if 'ip' in worker %}
networkConfig: |
{{ static_network.config(worker['ip'], baremetal_prefix, worker['gateway']|default(baremetal_gateway), worker['dns']|default(baremetal_dns), cluster, domain, worker['nic']|default(nic)) }}
{% elif 'network_config' in worker %}
networkConfig: {{ worker['network_config']|replace('\n', '\n ') }}
{% endif %}
{% endfor %}
{% if cas %}
additionalTrustBundle: |
{% for ca in cas %}
{{ ca | certificate | replace('\n', '\n ') }}
{% endfor %}
{% endif %}
{% if disconnected_url is defined %}
imageContentSources:
- mirrors:
- {{ disconnected_url }}/ocp/release
source: quay.io/openshift-release-dev/ocp-v4.0-art-dev
- mirrors:
- {{ disconnected_url }}/ocp/release
source: registry.ci.openshift.org/ocp/release
{% elif imagecontentsources %}
imageContentSources:
{% for source in imagecontentsources %}
- mirrors:
- {{ source }}
source: image-registry.openshift-image-registry.svc:5000/openshift/{{ source | basename | replace("openshift-", "")}}
{% endfor %}
{% endif %}