-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathoneview_enclosure_group.yml
134 lines (127 loc) · 4.52 KB
/
oneview_enclosure_group.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
###
# Copyright (2016-2021) 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"
variant: "Synergy"
ip_range: False
lig_name: LIG
tasks:
- name: Gather facts about logical interconnect group
oneview_logical_interconnect_group_facts:
config: "{{ config }}"
name: "{{ lig_name }}"
delegate_to: localhost
- set_fact:
lig_uri: "{{ logical_interconnect_groups[0]['uri'] }}"
- name: Create an Enclosure Group
oneview_enclosure_group:
config: "{{ config }}"
state: present
data:
name: "{{ item.name }}"
ipAddressingMode: "External"
ipv6AddressingMode: "External"
enclosureCount: 3
osDeploymentSettings:
manageOSDeployment: true
deploymentModeSettings:
deploymentMode: "Internal"
interconnectBayMappings:
- interconnectBay: 3
logicalInterconnectGroupUri: "{{ lig_uri }}"
- interconnectBay: 6
logicalInterconnectGroupUri: "{{ lig_uri }}"
delegate_to: localhost
with_items:
- { name: 'EG' }
- { name: 'Enclosure Group 1' }
# Run this exampleto create enclosure group with interconnects having ip rangeUris
- name: Create an Enclosure Group with ip rangeUris
oneview_enclosure_group:
config: "{{ config }}"
state: present
data:
name: "EG_with_ip_range"
ipAddressingMode: "IpPool"
ipRangeUris:
- /rest/id-pools/ipv4/ranges/d4321a21-42b5-4a1e-9c44-9e8bf9339dfa
ipv6AddressingMode: "External"
enclosureCount: 3
osDeploymentSettings:
manageOSDeployment: true
deploymentModeSettings:
deploymentMode: "Internal"
interconnectBayMappings:
- interconnectBay: 3
logicalInterconnectGroupUri: "{{ lig_uri }}"
- interconnectBay: 6
logicalInterconnectGroupUri: "{{ lig_uri }}"
delegate_to: localhost
when: ip_range == 'True'
- name: Do nothing with the Enclosure Group when no changes are provided
oneview_enclosure_group:
config: "{{ config }}"
state: present
data:
name: "Enclosure Group 1"
ipAddressingMode: "External"
ipv6AddressingMode: "External"
enclosureCount: 3
osDeploymentSettings:
manageOSDeployment: true
deploymentModeSettings:
deploymentMode: "Internal"
interconnectBayMappings:
- interconnectBay: 3
logicalInterconnectGroupUri: "{{ lig_uri }}"
- interconnectBay: 6
logicalInterconnectGroupUri: "{{ lig_uri }}"
delegate_to: localhost
- name: Update the Enclosure Group changing the name attribute
oneview_enclosure_group:
config: "{{ config }}"
state: present
data:
name: "Enclosure Group 1"
newName: "Enclosure Group 1 (renamed)"
delegate_to: localhost
# This play is compatible with C7000 Enclosures
- name: Update the Enclosure Group configuration script
oneview_enclosure_group:
config: "{{ config }}"
state: present
data:
name: "Enclosure Group 1 (renamed)"
configurationScript: "# script (updated)"
delegate_to: localhost
when: variant == "C7000"
- name: Delete the Enclosure Group
oneview_enclosure_group:
config: "{{ config }}"
state: absent
data:
name: "Enclosure Group 1 (renamed)"
delegate_to: localhost
- name: Do nothing when Enclosure Group is absent
oneview_enclosure_group:
config: "{{ config }}"
state: absent
data:
name: "Enclosure Group 1 (renamed)"
delegate_to: localhost
delegate_to: localhost