forked from HewlettPackard/oneview-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oneview_server_hardware.yml
125 lines (116 loc) · 4.04 KB
/
oneview_server_hardware.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
###
# 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.
###
---
- hosts: all
vars:
config: "{{ playbook_dir }}/oneview_config.json"
server_hardware_hostname: '<server_hardware_host_name>'
server_hardware_username: '<server_hardware_user_name>'
server_hardware_password: '<server_hardware_user_password>'
scope_uris:
- '<scope_uri_1>'
vars_files:
- "{{ playbook_dir }}/vars/config.yml"
tasks:
- name: Add a Server Hardware
oneview_server_hardware:
config: "{{ config }}"
state: present
data:
hostname : '{{ server_hardware_hostname }}'
username : '{{ server_hardware_username }}'
password : '{{ server_hardware_password }}'
force : false
licensingIntent: "OneView"
configurationState: "Managed"
scopeUris: "{{ scope_uris }}"
delegate_to: localhost
- name: Do nothing when the server hardware is already present
oneview_server_hardware:
config: "{{ config }}"
state: present
data:
hostname : '{{ server_hardware_hostname }}'
username : '{{ server_hardware_username }}'
password : '{{ server_hardware_password }}'
force : false
licensingIntent: "OneView"
configurationState: "Managed"
delegate_to: localhost
- name: Power Off the server hardware
oneview_server_hardware:
config: "{{ config }}"
state: power_state_set
data:
name : '{{ server_hardware_hostname }}'
powerStateData:
powerState: "Off"
powerControl: "MomentaryPress"
delegate_to: localhost
- name: Power On the server hardware
oneview_server_hardware:
config: "{{ config }}"
state: power_state_set
data:
name : '{{ server_hardware_hostname }}'
powerStateData:
powerState: "On"
powerControl: "MomentaryPress"
delegate_to: localhost
- name: Refresh the server hardware
oneview_server_hardware:
config: "{{ config }}"
state: refresh_state_set
data:
name : '{{ server_hardware_hostname }}'
refreshStateData:
refreshState : "RefreshPending"
delegate_to: localhost
- name: Update the Server Hardware iLO firmware version
oneview_server_hardware:
config: "{{ config }}"
state: ilo_firmware_version_updated
data:
name : '{{ server_hardware_hostname }}'
delegate_to: localhost
- name: Reset the Server Hardware iLO State
oneview_server_hardware:
config: "{{ config }}"
state: ilo_state_reset
data:
name: '{{ server_hardware_hostname }}'
delegate_to: localhost
- name: Set the server UID state off
oneview_server_hardware:
config: "{{ config }}"
state: uid_state_off
data:
name: '{{ server_hardware_hostname }}'
delegate_to: localhost
- name: Remove the server hardware by its IP
oneview_server_hardware:
config: "{{ config }}"
state: absent
data:
name : '{{ server_hardware_hostname }}'
delegate_to: localhost
- name: Do nothing when the server hardware is already removed
oneview_server_hardware:
config: "{{ config }}"
state: absent
data:
name : '{{ server_hardware_hostname }}'
delegate_to: localhost