| 1 |
.. _redfish_powerstate_module: |
| 2 |
|
| 3 |
|
| 4 |
redfish_powerstate -- Manage device power state |
| 5 |
=============================================== |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
This module allows to manage the different power states of the specified device. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
Requirements |
| 20 |
------------ |
| 21 |
The below requirements are needed on the host that executes this module. |
| 22 |
|
| 23 |
- python \>= 3.9.6 |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
Parameters |
| 28 |
---------- |
| 29 |
|
| 30 |
resource_id (False, str, None) |
| 31 |
This option is the unique identifier of the device being managed. For example, \ https://%3CI(baseuri\ \>/redfish/v1/Systems/\<\ :emphasis:`resource\_id`\ \>). |
| 32 |
|
| 33 |
This option is mandatory for \ :emphasis:`base\_uri`\ with multiple devices. |
| 34 |
|
| 35 |
To get the device details, use the API \ https://%3CI(baseuri\ \>/redfish/v1/Systems) for reset\_type operation and \ https://%3CI(baseuri\ \>/redfish/v1/Chassis) for oem\_reset\_type operation. |
| 36 |
|
| 37 |
|
| 38 |
reset_type (False, str, None) |
| 39 |
This option resets the device. |
| 40 |
|
| 41 |
\ :literal:`ForceOff`\ turns off the device immediately. |
| 42 |
|
| 43 |
\ :literal:`ForceOn`\ turns on the device immediately. |
| 44 |
|
| 45 |
\ :literal:`ForceRestart`\ turns off the device immediately, and then restarts the server. |
| 46 |
|
| 47 |
\ :literal:`GracefulRestart`\ performs graceful shutdown of the device, and then restarts the device. |
| 48 |
|
| 49 |
\ :literal:`GracefulShutdown`\ performs a graceful shutdown of the device, and then turns off the device. |
| 50 |
|
| 51 |
\ :literal:`Nmi`\ sends a diagnostic interrupt to the device. This option is usually a nonmaskable interrupt (NMI) on x86 systems. |
| 52 |
|
| 53 |
\ :literal:`On`\ turns on the device. |
| 54 |
|
| 55 |
\ :literal:`PowerCycle`\ performs a power cycle on the device. |
| 56 |
|
| 57 |
\ :literal:`PushPowerButton`\ simulates the pressing of a physical power button on the device. |
| 58 |
|
| 59 |
\ :emphasis:`reset\_type`\ is mutually exclusive with \ :emphasis:`oem\_reset\_type`\ . |
| 60 |
|
| 61 |
When a power control operation is performed, which is not supported on the device, an error message is displayed with the list of operations that can be performed. |
| 62 |
|
| 63 |
|
| 64 |
oem_reset_type (False, dict, None) |
| 65 |
This parameter initiates a complete Alternate Current (AC) power cycle of the server which is equivalent to disconnecting power cables using OEM API. |
| 66 |
|
| 67 |
\ :emphasis:`oem\_reset\_type`\ is mutually exclusive with \ :emphasis:`reset\_type`\ . |
| 68 |
|
| 69 |
If the value of 'final\_power\_state' is not provided, the default value is 'Off'. |
| 70 |
|
| 71 |
|
| 72 |
baseuri (True, str, None) |
| 73 |
IP address of the target out-of-band controller. For example- \<ipaddress\>:\<port\>. |
| 74 |
|
| 75 |
|
| 76 |
username (False, str, None) |
| 77 |
Username of the target out-of-band controller. |
| 78 |
|
| 79 |
If the username is not provided, then the environment variable \ :envvar:`IDRAC\_USERNAME`\ is used. |
| 80 |
|
| 81 |
Example: export IDRAC\_USERNAME=username |
| 82 |
|
| 83 |
|
| 84 |
password (False, str, None) |
| 85 |
Password of the target out-of-band controller. |
| 86 |
|
| 87 |
If the password is not provided, then the environment variable \ :envvar:`IDRAC\_PASSWORD`\ is used. |
| 88 |
|
| 89 |
Example: export IDRAC\_PASSWORD=password |
| 90 |
|
| 91 |
|
| 92 |
x_auth_token (False, str, None) |
| 93 |
Authentication token. |
| 94 |
|
| 95 |
If the x\_auth\_token is not provided, then the environment variable \ :envvar:`IDRAC\_X\_AUTH\_TOKEN`\ is used. |
| 96 |
|
| 97 |
Example: export IDRAC\_X\_AUTH\_TOKEN=x\_auth\_token |
| 98 |
|
| 99 |
|
| 100 |
validate_certs (optional, bool, True) |
| 101 |
If \ :literal:`false`\ , the SSL certificates will not be validated. |
| 102 |
|
| 103 |
Configure \ :literal:`false`\ only on personally controlled sites where self-signed certificates are used. |
| 104 |
|
| 105 |
Prior to collection version \ :literal:`5.0.0`\ , the \ :emphasis:`validate\_certs`\ is \ :literal:`false`\ by default. |
| 106 |
|
| 107 |
|
| 108 |
ca_path (optional, path, None) |
| 109 |
The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation. |
| 110 |
|
| 111 |
|
| 112 |
timeout (optional, int, 30) |
| 113 |
The socket level timeout in seconds. |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
Notes |
| 120 |
----- |
| 121 |
|
| 122 |
.. note:: |
| 123 |
- Run this module from a system that has direct access to Redfish APIs. |
| 124 |
- This module supports \ :literal:`check\_mode`\ . |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
Examples |
| 130 |
-------- |
| 131 |
|
| 132 |
.. code-block:: yaml+jinja |
| 133 |
|
| 134 |
|
| 135 |
--- |
| 136 |
- name: Manage power state of the first device |
| 137 |
dellemc.openmanage.redfish_powerstate: |
| 138 |
baseuri: "192.168.0.1" |
| 139 |
username: "username" |
| 140 |
password: "password" |
| 141 |
ca_path: "/path/to/ca_cert.pem" |
| 142 |
reset_type: "On" |
| 143 |
|
| 144 |
- name: Manage power state of a specified device |
| 145 |
dellemc.openmanage.redfish_powerstate: |
| 146 |
baseuri: "192.168.0.1" |
| 147 |
username: "username" |
| 148 |
password: "password" |
| 149 |
ca_path: "/path/to/ca_cert.pem" |
| 150 |
reset_type: "ForceOff" |
| 151 |
resource_id: "System.Embedded.1" |
| 152 |
|
| 153 |
- name: Perform AC Power Cycle with final power state On |
| 154 |
dellemc.openmanage.redfish_powerstate: |
| 155 |
baseuri: "192.168.0.1" |
| 156 |
username: "username" |
| 157 |
password: "password" |
| 158 |
ca_path: "/path/to/ca_cert.pem" |
| 159 |
oem_reset_type: |
| 160 |
dell: |
| 161 |
final_power_state: "On" |
| 162 |
reset_type: "PowerCycle" |
| 163 |
|
| 164 |
- name: Perform AC Power Cycle with final power state Off |
| 165 |
dellemc.openmanage.redfish_powerstate: |
| 166 |
baseuri: "192.168.0.1" |
| 167 |
username: "username" |
| 168 |
password: "password" |
| 169 |
ca_path: "/path/to/ca_cert.pem" |
| 170 |
oem_reset_type: |
| 171 |
dell: |
| 172 |
final_power_state: "Off" |
| 173 |
reset_type: "PowerCycle" |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
Return Values |
| 178 |
------------- |
| 179 |
|
| 180 |
msg (always, str, Successfully performed the reset type operation 'On'.) |
| 181 |
Overall status of the reset operation. |
| 182 |
|
| 183 |
|
| 184 |
error_info (on http error, dict, {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to complete the operation because the resource /redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset entered in not found.', 'MessageArgs': ['/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset'], '[email protected]': 1, 'MessageId': 'IDRAC.2.1.SYS403', 'RelatedProperties': [], '[email protected]': 0, 'Resolution': 'Enter the correct resource and retry the operation. For information about valid resource, see the Redfish Users Guide available on the support site.', 'Severity': 'Critical'}], 'code': 'Base.1.5.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}}) |
| 185 |
Details of the HTTP error. |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
Status |
| 192 |
------ |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
Authors |
| 199 |
~~~~~~~ |
| 200 |
|
| 201 |
- Sajna Shetty(@Sajna-Shetty) |
| 202 |
- Lovepreet Singh (@singh-lovepreet1) |
| 203 |
|