forked from HewlettPackard/oneview-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoneview_server_profile.yml
148 lines (132 loc) · 4.69 KB
/
oneview_server_profile.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
###
# Copyright (2016-2017) 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.
###
---
# This example contains examples of server profiles with basic configuration.
# Some other examples of how to create a server profile with advanced settings available:
#
# End-to-end example of how to create a Server Profile with SAN storage settings, with a new storage volume created
# upon profile creation:
# - examples/c7000_environment_setup.yml
#
# End-to-end example of how to create a Server Profile with Local Storage:
# - examples/synergy_environment_setup.yml
#
# # HPE ICsp Bare metal server provisioning:
# - examples/ICsp
# - examples/oneview-web-farm
#
# HPE Image Streamer Bare metal server provisioning:
# - examples/ImageStreamer
# - exampĺes/synergy_create_server_profile_with_deployment_plan.yml
# - examples/synergy_image_streamer.yml
# - examples/synergy_server_profile_os_deploy.yml
##
- hosts: all
vars:
- config: "{{ playbook_dir }}/oneview_config.json"
# Set the name of the server profile template that will be used to provision the server profile
- ov_template: 'SY 480 Gen9 1'
# Set the name of an existing enclosure group to run this example
- enclosure_group_name: 'encl-group1'
# Set the name of an existing server hardware type to run this example
- server_hardware_type_name: 'SY 480 Gen9 1'
# Set the name of an existing ethernet network
- network_name: 'eth-demo'
tasks:
- name: Create a Server Profile from a Server Profile Template
oneview_server_profile:
config: "{{ config }}"
data:
server_template: "{{ ov_template }}"
name: "{{ inventory_hostname }}"
delegate_to: localhost
register: result
- debug: msg="{{ result.msg }}"
- debug: var=server_profile
- debug: var=serial_number
- debug: var=server_hardware
- debug: var=compliance_preview
- debug: var=created
- name: Create a Server Profile with connections
oneview_server_profile:
config: "{{ config }}"
data:
name: "{{ inventory_hostname }}-with-connections"
connections:
- id: 1
name: connection1
functionType: Ethernet
portId: Auto
requestedMbps: 2500
networkName: "{{ network_name }}"
delegate_to: localhost
- debug: msg="{{ server_profile }}"
- name: Update Server Profile
oneview_server_profile:
config: "{{ config }}"
state: "present"
data:
name: "{{ inventory_hostname }}"
affinity: "BayAndServer"
bootMode:
manageMode: True
mode: "BIOS"
delegate_to: localhost
register: result
- debug: msg="{{result.msg}}"
- debug: var=server_profile
- name: Remediate compliance issues
oneview_server_profile:
config: "{{ config }}"
state: "compliant"
data:
name: "{{ inventory_hostname }}"
delegate_to: localhost
register: result
- debug: msg="{{ result.msg }}"
- name: Delete the Server Profile created from a Server Profile Template
oneview_server_profile:
config: "{{ config }}"
state: "absent"
data:
name: "{{ inventory_hostname }}"
delegate_to: localhost
register: result
- debug: msg="{{ result.msg }}"
- name: Delete the Server Profile created with connections
oneview_server_profile:
config: "{{ config }}"
state: "absent"
data:
name: "{{ inventory_hostname }}-with-connections"
delegate_to: localhost
- debug: msg="{{ result.msg }}"
- name: Create Server Profile without specifying a template
oneview_server_profile:
config: "{{ config }}"
data:
name: "{{ inventory_hostname }}"
serverHardwareTypeName: "{{ server_hardware_type_name }}"
enclosureGroupName: "{{ enclosure_group_name }}"
delegate_to: localhost
- debug: var=server_profile
- name: Delete the Server Profile
oneview_server_profile:
config: "{{ config }}"
state: "absent"
data:
name: "{{ inventory_hostname }}"
delegate_to: localhost