-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathserver_profile_template.rb
63 lines (55 loc) · 2.28 KB
/
server_profile_template.rb
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
# (c) Copyright 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.
# NOTES:
# This example requires the following resources to be available in the appliance:
# - Server Profile: 'ServerProfile1'
# - Server Hardware Type: 'BL660c Gen9 1'
# - Enclosure Group: 'EnclosureGroup1'
my_client = {
url: ENV['ONEVIEWSDK_URL'],
user: ENV['ONEVIEWSDK_USER'],
password: ENV['ONEVIEWSDK_PASSWORD'],
api_version: 3000
}
enclosure_group = 'EG'
server_hardware_type = 'SY 480 Gen9 1'
sp_name = 'ServerProfile1'
# Creates on server profile template with the desired Enclosure group and Server hardware type
oneview_server_profile_template 'ServerProfileTemplate1' do
client my_client
enclosure_group enclosure_group
server_hardware_type server_hardware_type
end
# Creates on server profile template with the desired Enclosure group and Server hardware type
oneview_server_profile_template 'ServerProfileTemplate1' do
client my_client
enclosure_group enclosure_group
server_hardware_type server_hardware_type
action :create_if_missing
end
# Creates a server profile template using the server profile 'ServerProfile1' as a templates
# Note: Only for api 500 or api600, comment this recipe if you are not using api500 or api600.
oneview_server_profile_template 'ServerProfileTemplate2' do
client my_client
server_profile_name sp_name
only_if { client[:api_version] == 500 || client[:api_version] == 600 }
end
# Deletes server profile 'ServerProfileTemplate1'
oneview_server_profile_template 'ServerProfileTemplate1' do
client my_client
action :delete
end
# Deletes server profile 'ServerProfileTemplate2'
oneview_server_profile_template 'ServerProfileTemplate2' do
client my_client
action :delete
only_if { client[:api_version] == 500 || client[:api_version] == 600 }
end