-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathoneview_logical_enclosure.yml
166 lines (152 loc) · 6.03 KB
/
oneview_logical_enclosure.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
###
# Copyright (2016-2020) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###
---
- hosts: all
vars:
config: "{{ playbook_dir }}/oneview_config.json"
logical_enclosure_name: "LE" # Set the name of a Logical Enclosure
firmware_name: "SPP_2018_11_20190205_for_HPE_Synergy_Z7550-96592" # Set the name of a Firmware Driver
variant: "Synergy"
eg_name: EG
tasks:
- name: Gather facts about all Enclosures
oneview_enclosure_facts:
config: "{{ config }}"
delegate_to: localhost
- name: Gather facts about all Enclosure Groups
oneview_enclosure_group_facts:
config: "{{ config }}"
name: "{{ eg_name }}"
delegate_to: localhost
- name: Gather facts about all Firmware Drivers
oneview_firmware_driver_facts:
config: "{{ config }}"
- debug: var=firmware_drivers
# This operation is only available on HPE Synergy
- name: Create a Logical Enclosure (available only on HPE Synergy)
oneview_logical_enclosure:
config: "{{ config }}"
state: present
data:
enclosureUris:
- "{{ enclosures[0]['uri'] }}"
- "{{ enclosures[1]['uri'] }}"
- "{{ enclosures[2]['uri'] }}"
enclosureGroupUri: "{{ enclosure_groups['uri'] }}"
name: "{{ logical_enclosure_name }}"
ignore_errors: true
delegate_to: localhost
when: (variant == "Synergy" and enclosures is not none and enclosures is not undefined and
enclosure_groups is not none and enclosure_groups is not undefined)
- name: Update the firmware for the Logical Enclosure
oneview_logical_enclosure:
config: "{{ config }}"
state: firmware_updated
data:
name: "{{ logical_enclosure_name }}"
firmware:
firmwareBaselineUri: "{{ firmware_drivers[0]['uri'] }}"
firmwareUpdateOn: "EnclosureOnly"
forceInstallFirmware: "false"
custom_headers:
if-Match: '*'
ignore_errors: true
delegate_to: localhost
when: (enclosures is not none and enclosures is not undefined and enclosure_groups is not none
and enclosure_groups is not undefined and firmware_drivers is not none and firmware_drivers
is not undefined)
# This play is compatible with Synergy Enclosures
- name: Update the firmware for the Logical Enclosure with the logical-interconnect validation set as true
oneview_logical_enclosure:
config: "{{ config }}"
state: firmware_updated
data:
name: "{{ logical_enclosure_name }}"
firmware:
firmwareBaselineUri: "{{ firmware_drivers[0]['uri'] }}"
firmwareUpdateOn: "EnclosureOnly"
forceInstallFirmware: "false"
validateIfLIFirmwareUpdateIsNonDisruptive: "true"
logicalInterconnectUpdateMode: "Orchestrated"
updateFirmwareOnUnmanagedInterconnect: "true"
custom_headers:
if-Match: '*'
ignore_errors: true
delegate_to: localhost
when: (variant == "Synergy" and firmware_drivers is not none and firmware_drivers
is not undefined)
- name: Update the Logical Enclosure configuration script(available only on C7000)
oneview_logical_enclosure:
config: "{{ config }}"
state: script_updated
data:
name: "{{ logical_enclosure_name }}"
configurationScript: "# script (updated)"
ignore_errors: true
delegate_to: localhost
when: variant == "C7000"
- name: Generates a support dump for the Logical Enclosure
oneview_logical_enclosure:
config: "{{ config }}"
state: dumped
data:
name: "{{ logical_enclosure_name }}"
dump:
errorCode: "MyDump16"
encrypt: "true"
excludeApplianceDump: "false"
delegate_to: localhost
- debug: var=generated_dump_uri
- name: Reconfigure all enclosures associated with logical enclosure
oneview_logical_enclosure:
config: "{{ config }}"
state: reconfigured
data:
name: "{{ logical_enclosure_name }}"
delegate_to: localhost
- name: Makes the logical enclosure consistent with the enclosure group
oneview_logical_enclosure:
config: "{{ config }}"
state: updated_from_group
data:
name: "{{ logical_enclosure_name }}"
delegate_to: localhost
- name: Update the Logical Enclosure changing the name attribute
oneview_logical_enclosure:
config: "{{ config }}"
state: present
data:
name: "{{ logical_enclosure_name }}"
newName: "{{ logical_enclosure_name }} (renamed)"
delegate_to: localhost
- name: Rename the Logical Enclosure to its initial name
oneview_logical_enclosure:
config: "{{ config }}"
state: present
data:
name: "{{ logical_enclosure_name }} (renamed)"
newName: "{{ logical_enclosure_name }}"
delegate_to: localhost
# This state is only available on HPE Synergy
# Commenting this to ensure continuity for automation script
# - name: Delete a Logical Enclosure (available only on HPE Synergy)
# oneview_logical_enclosure:
# config: "{{ config }}"
# state: absent
# data: '{{ logical_enclosure }}'
# ignore_errors: true
# delegate_to: localhost
# when: variant == "Synergy"