-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRHEL_SPT_creation_Boot_from_SAN.yml
330 lines (307 loc) · 12.3 KB
/
RHEL_SPT_creation_Boot_from_SAN.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
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
---
# Before executing this playbook, you must run Enable_jinja2_native.yml to set Jinja2 Native to True
# Jinja2 Native mode enables Jinja2 template to return Integer and not String as by default with Ansible, no matter if int format is used
# If Jinja2 Native mode is disabled, the Boot from SAN volume creation will fail as the size output is always converted to a string by Ansible.
- name: Server profile template for RHEL with boot from SAN storage volume created upon profile creation from this template
hosts: localhost
collections:
- hpe.oneview
gather_facts: no
vars_files:
- vars/iLO_vars_encrypted.yml # Define the iLO local account to be created. This account is required by the community.general collection to manage an iLO
vars:
config: "{{ playbook_dir }}/oneview_config.json"
server_profile_template_name: "RHEL_BFS_Frame4"
server_hardware_type_name: "SY 480 Gen10 4"
enclosure_group_name: "EG_1_Frame"
connection_network_management_name: "Management-Nexus"
connection_fabric_A_name: "FC-A"
connection_fabric_B_name: "FC-B"
connection_network_set_name: "Production_network_set"
synergy_service_pack_version: "SY-2021.05.03"
storage_system_name: "3par.lj.lab"
storage_pool_name: "SSD_r5"
# Size of the RHEL boot volume created upon profile creation from this template (in GB)
boot_volume_size_GB: 50
# Name of the existing datastore volume to present
datastore_volume_name: "RHEL Frame4 Docker Volume"
tasks:
# Gathering the necessary information to create the Server Profile Template
- name: Gather facts about the Storage System "{{ storage_system_name }}" and its volume templates
oneview_storage_system_facts:
config: "{{ config }}"
storage_hostname: "{{ storage_system_name }}"
options:
- templates
- storagePools
params:
sort: "name:descending"
# - debug: var=storage_system_templates
# - debug: var=storage_systems
# - debug: var=storage_system_pools
- name: Capture Storage System "{{ storage_system_name }}" uri AND volume template uri AND storage pools uri
set_fact:
templateUri: "{{ (storage_system_templates.members | map(attribute='uri') | list)[0] }}"
storage_system_uri: "{{ (storage_systems | map(attribute='uri') | list)[0] }}"
storagePoolsUri: "{{ (storage_system_pools.members | selectattr('name', 'equalto', storage_pool_name) | map(attribute='uri') | list)[0] }}"
# - debug: var=templateUri
# - debug: var=storage_system_uri
# - debug: var=storagePoolsUri
- name: Gather facts about Firmware bundles
oneview_firmware_driver_facts:
config: "{{ config }}"
# version: "{{ synergy_service_pack_version }}"
delegate_to: localhost
# - debug: var=firmware_drivers
- name: Capture firmware bundle "{{ synergy_service_pack_version }}" uri
set_fact:
firmware_Baseline_Uri: "{{ (firmware_drivers | selectattr('version', 'equalto', synergy_service_pack_version) | map(attribute='uri') | list)[0] }}"
# - debug: var=firmware_Baseline_Uri
- name: Gather facts about the storage volume "{{ datastore_volume_name }}" on "{{ storage_system_name }}"
oneview_volume_facts:
config: "{{ config }}"
name: "{{ datastore_volume_name }}"
delegate_to: localhost
# - debug: var=storage_volumes
- name: Capture storage volume "{{ datastore_volume_name }}" uri on "{{ storage_system_name }}"
set_fact:
datastore_volume_uri: "{{ (storage_volumes | map(attribute='uri') | list)[0] }}"
# - debug: var=datastore_volume_uri
# Creating the Server Profile Template
- name: Create a server profile template for RHEL
oneview_server_profile_template:
config: "{{ config }}"
state: present
data:
name: "{{ server_profile_template_name }}"
description: "Server profile template for RHEL with boot from SAN storage volumes created upon profile creation from this template"
serverProfileDescription: "Server profile template for RHEL with boot from SAN storage volumes created upon profile creation from this template"
serverHardwareTypeName: "{{ server_hardware_type_name }}"
enclosureGroupName: "{{ enclosure_group_name }}"
affinity: Bay
hideUnusedFlexNics: true
macType: Virtual
wwnType: Virtual
serialNumberType: Virtual
iscsiInitiatorNameType: AutoGenerated
osDeploymentSettings:
firmware:
complianceControl: Checked
firmwareActivationType: Immediate
firmwareBaselineUri: "{{ firmware_Baseline_Uri }}"
firmwareInstallType: FirmwareOnlyOfflineMode
forceInstallFirmware: false
manageFirmware: true
connectionSettings:
complianceControl: Checked
manageConnections: true
connections:
- id: 1
name: Mgmt1
functionType: Ethernet
networkName: "{{ connection_network_management_name }}"
# portId: Mezz 3:1-a
portId: Auto
# requestedVFs: '0'
requestedMbps: "2500"
# boot:
# priority: NotBootable
# bootVlanId:
# lagName:
managed: true
# isolatedTrunk: false
# networkName:
- id: 2
name: Mgmt2
functionType: Ethernet
networkName: "{{ connection_network_management_name }}"
# portId: Mezz 3:2-a
portId: Auto
# requestedVFs: '0'
requestedMbps: "2500"
# boot:
# priority: NotBootable
# bootVlanId:
# lagName:
managed: true
# isolatedTrunk: false
# networkName:
- id: 3
name: FC-A
functionType: FibreChannel
networkName: "{{ connection_fabric_A_name }}"
# portId: Mezz 3:1-b
portId: Auto
# requestedVFs:
requestedMbps: "2500"
boot:
bootVolumeSource: ManagedVolume
priority: LoadBalanced
# bootVlanId:
# lagName:
managed: true
isolatedTrunk: false
# networkName:
- id: 4
name: FC-B
functionType: FibreChannel
networkName: "{{ connection_fabric_B_name }}"
# portId: Mezz 3:2-b
portId: Auto
# requestedVFs:
requestedMbps: "2500"
boot:
bootVolumeSource: ManagedVolume
priority: LoadBalanced
# bootVlanId:
# lagName:
managed: true
isolatedTrunk: false
# networkName:
- id: 5
name: "NetworkSet1"
functionType: Ethernet
networkName: "{{ connection_network_set_name }}"
# portId: Mezz 3:1-d
portId: Auto
requestedVFs: "0"
requestedMbps: "2500"
boot:
priority: NotBootable
# bootVlanId:
# lagName:
managed: true
isolatedTrunk: false
# networkName:
- id: 6
name: "NetworkSet2"
functionType: Ethernet
networkName: "{{ connection_network_set_name }}"
# portId: Mezz 3:2-d
portId: Auto
requestedVFs: "0"
requestedMbps: "2500"
boot:
priority: NotBootable
# bootVlanId:
# lagName:
managed: true
isolatedTrunk: false
# networkName:
bootMode:
complianceControl: Checked
manageMode: true
mode: UEFIOptimized
pxeBootPolicy: Auto
secureBoot: Unmanaged
boot:
complianceControl: Checked
manageBoot: true
order:
- HardDisk
bios:
complianceControl: Checked
manageBios: true
overriddenSettings:
- id: WorkloadProfile
value: Virtualization-MaxPerformance
- id: MinProcIdlePower
value: NoCStates
- id: IntelUpiPowerManagement
value: Disabled
- id: MinProcIdlePkgState
value: NoState
- id: EnergyPerfBias
value: MaxPerf
- id: UncoreFreqScaling
value: Maximum
- id: PowerRegulator
value: StaticHighPerf
- id: SubNumaClustering
value: Enabled
- id: CollabPowerControl
value: Disabled
- id: EnergyEfficientTurbo
value: Disabled
- id: NumaGroupSizeOpt
value: Clustered
managementProcessor:
complianceControl: Checked
manageMp: true
mpSettings:
- settingType: LocalAccounts
args:
localAccounts:
- userName: "{{ iLO_username }}"
displayName: "{{ iLO_username }}"
password: "{{ iLO_password }}"
userConfigPriv: true
remoteConsolePriv: true
virtualMediaPriv: true
virtualPowerAndResetPriv: true
iLOConfigPriv: true
loginPriv: true
hostBIOSConfigPriv: true
hostNICConfigPriv: true
hostStorageConfigPriv: true
localStorage:
complianceControl: Unchecked
sasLogicalJBODs: []
controllers: []
sanStorage:
complianceControl: CheckedMinimum
manageSanStorage: true
hostOSType: RHE Linux (5.x, 6.x, 7.x, 8.x)
sanSystemCredentials: []
volumeAttachments:
- id: 1
lun:
lunType: Auto
storagePaths:
- connectionId: 4
isEnabled: true
targetSelector: Auto
targets: []
- connectionId: 3
isEnabled: true
targetSelector: Auto
targets: []
volumeUri:
volume:
templateUri: "{{ templateUri }}"
properties:
name: RHEL_Boot
description: "Boot from SAN volume for RHEL"
storagePool: "{{ storagePoolsUri }}"
size: "{{ boot_volume_size_GB *1024*1024*1024 }}"
# size: 53687091200
provisioningType: Thin
isShareable: false
templateVersion: "1.1"
snapshotPool: "{{ storagePoolsUri }}"
isDeduplicated: true
initialScopeUris:
isPermanent: false
volumeStorageSystemUri: "{{ storage_system_uri }}"
bootVolumePriority: Primary
- id: 2
lun:
lunType: Auto
storagePaths:
- connectionId: 4
isEnabled: true
targetSelector: Auto
targets: []
- connectionId: 3
isEnabled: true
targetSelector: Auto
targets: []
volumeUri: "{{ datastore_volume_uri }}"
volume:
isPermanent: true
volumeStorageSystemUri: "{{ storage_system_uri }}"
bootVolumePriority: NotBootable
- name: Displaying create completed message
debug:
msg:
- "Server Profile Template '{{ server_profile_template_name }}' has been created successfully !"