| 1 | # idrac_server_powerstate |
| 2 | |
| 3 | Role to to manage the different power states of the specified device using iDRACs (iDRAC8 and iDRAC9 only) for Dell PowerEdge servers. |
| 4 | |
| 5 | ## Requirements |
| 6 | |
| 7 | ### Development |
| 8 | Requirements to develop and contribute to the role. |
| 9 | ``` |
| 10 | ansible |
| 11 | docker |
| 12 | molecule |
| 13 | python |
| 14 | ``` |
| 15 | ### Production |
| 16 | Requirements to use the role. |
| 17 | ``` |
| 18 | ansible |
| 19 | python |
| 20 | ``` |
| 21 | |
| 22 | ### Ansible collections |
| 23 | Collections required to use the role |
| 24 | ``` |
| 25 | dellemc.openmanage |
| 26 | ``` |
| 27 | |
| 28 | ## Role Variables |
| 29 | |
| 30 | <table> |
| 31 | <thead> |
| 32 | <tr> |
| 33 | <th>Name</th> |
| 34 | <th>Required</th> |
| 35 | <th>Default Value</th> |
| 36 | <th>Choices</th> |
| 37 | <th>Type</th> |
| 38 | <th>Description</th> |
| 39 | </tr> |
| 40 | </thead> |
| 41 | <tbody> |
| 42 | <tr> |
| 43 | <td>hostname</td> |
| 44 | <td>true</td> |
| 45 | <td></td> |
| 46 | <td></td> |
| 47 | <td>str</td> |
| 48 | <td>- iDRAC IP Address</td> |
| 49 | </tr> |
| 50 | <tr> |
| 51 | <td>username</td> |
| 52 | <td>true</td> |
| 53 | <td></td> |
| 54 | <td></td> |
| 55 | <td>str</td> |
| 56 | <td>- iDRAC username</td> |
| 57 | </tr> |
| 58 | <tr> |
| 59 | <td>password</td> |
| 60 | <td>true</td> |
| 61 | <td></td> |
| 62 | <td></td> |
| 63 | <td>str</td> |
| 64 | <td>- iDRAC user password.</td> |
| 65 | </tr> |
| 66 | <tr> |
| 67 | <td>https_port</td> |
| 68 | <td>false</td> |
| 69 | <td>443</td> |
| 70 | <td></td> |
| 71 | <td>int</td> |
| 72 | <td>- iDRAC port.</td> |
| 73 | </tr> |
| 74 | <tr> |
| 75 | <td>validate_certs</td> |
| 76 | <td>false</td> |
| 77 | <td>true</td> |
| 78 | <td></td> |
| 79 | <td>bool</td> |
| 80 | <td>- If C(false), the SSL certificates will not be validated.<br>- Configure C(false) only on personally controlled sites where self-signed certificates are used.</td> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <td>ca_path</td> |
| 84 | <td>false</td> |
| 85 | <td></td> |
| 86 | <td></td> |
| 87 | <td>path</td> |
| 88 | <td>- The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.</td> |
| 89 | </tr> |
| 90 | <tr> |
| 91 | <td>https_timeout</td> |
| 92 | <td>false</td> |
| 93 | <td>30</td> |
| 94 | <td></td> |
| 95 | <td>int</td> |
| 96 | <td>- The HTTPS socket level timeout in seconds.</td> |
| 97 | </tr> |
| 98 | <tr> |
| 99 | <td>resource_id</td> |
| 100 | <td>false</td> |
| 101 | <td></td> |
| 102 | <td></td> |
| 103 | <td>str</td> |
| 104 | <td>- This option is the unique identifier of the device being managed. For example, U(https://<I(baseuri)>/redfish/v1/Systems/<I(resource_id)>).<br>- This option is mandatory for I(base_uri) with multiple devices.<br>- To get the device details, use the API U(https://<I(baseuri)>/redfish/v1/Systems) for reset_type operation and |
| 105 | U(https://<I(baseuri)>/redfish/v1/Chassis) for oem_reset_type operation.</td> |
| 106 | </tr> |
| 107 | <tr> |
| 108 | <td>reset_type</td> |
| 109 | <td>false</td> |
| 110 | <td></td> |
| 111 | <td>["ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown", "Nmi", "On", "PowerCycle", "PushPowerButton"]</td> |
| 112 | <td>str</td> |
| 113 | <td>- This option resets the device.<br>- C(ForceOff) turns off the device immediately.<br>- C(ForceOn) turns on the device immediately.<br>- C(ForceRestart) turns off the device immediately, and then restarts the server.<br>- C(GracefulRestart) performs graceful shutdown of the device, and then restarts the device.<br>- C(GracefulShutdown) performs a graceful shutdown of the device, and then turns off the device.<br>- C(Nmi) sends a diagnostic interrupt to the device. This option is usually a nonmaskable interrupt (NMI) on x86 systems.<br>- C(On) turns on the device.<br>- C(PowerCycle) performs a power cycle on the device.<br>- C(PushPowerButton) simulates the pressing of a physical power button on the device.<br>- I(reset_type) is mutually exclusive with I(oem_reset_type).<br>- 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.</td> |
| 114 | </tr> |
| 115 | <tr> |
| 116 | <td>oem_reset_type</td> |
| 117 | <td>false</td> |
| 118 | <td></td> |
| 119 | <td></td> |
| 120 | <td>dict</td> |
| 121 | <td>- This parameter initiates a complete Alternate Current (AC) power cycle of the server which is equivalent to disconnecting power cables using OEM API.<br>- I(oem_reset_type) is mutually exclusive with I(reset_type).<br>- If the value of 'final_power_state' is not provided, the default value is 'Off'.</td> |
| 122 | </tr> |
| 123 | </tbody> |
| 124 | </table> |
| 125 | |
| 126 | ## Fact variables |
| 127 | |
| 128 | <table> |
| 129 | <thead> |
| 130 | <tr> |
| 131 | <th>Name</th> |
| 132 | <th>Sample</th> |
| 133 | <th>Description</th> |
| 134 | </tr> |
| 135 | </thead> |
| 136 | <tbody> |
| 137 | <tr> |
| 138 | <td>idrac_server_powerstate_out</td> |
| 139 | <td>{"changed": true, |
| 140 | "failed": false, |
| 141 | "msg": "Successfully performed the reset type operation 'GracefulRestart'." |
| 142 | }</td> |
| 143 | <td>Module output of the powercycle contol</td> |
| 144 | </tbody> |
| 145 | </table> |
| 146 | |
| 147 | ## Examples |
| 148 | ----- |
| 149 | |
| 150 | ``` |
| 151 | - name: "Performing force off operation" |
| 152 | ansible.builtin.include_role: |
| 153 | name: idrac_server_powerstate |
| 154 | vars: |
| 155 | hostname: "192.1.2.1" |
| 156 | username: "username" |
| 157 | password: "password" |
| 158 | ca_path: "/path/to/ca_cert.pem" |
| 159 | reset_type: "ForceOff" |
| 160 | |
| 161 | - name: "Performing power on operation" |
| 162 | ansible.builtin.include_role: |
| 163 | name: idrac_server_powerstate |
| 164 | vars: |
| 165 | hostname: "192.1.2.1" |
| 166 | username: "username" |
| 167 | password: "password" |
| 168 | ca_path: "/path/to/ca_cert.pem" |
| 169 | reset_type: "On" |
| 170 | |
| 171 | - name: "Performing graceful restart operation" |
| 172 | ansible.builtin.include_role: |
| 173 | name: idrac_server_powerstate |
| 174 | vars: |
| 175 | hostname: "192.1.2.1" |
| 176 | username: "username" |
| 177 | password: "password" |
| 178 | ca_path: "/path/to/ca_cert.pem" |
| 179 | reset_type: "GracefulRestart" |
| 180 | |
| 181 | - name: "Performing graceful shutdown operation" |
| 182 | ansible.builtin.include_role: |
| 183 | name: idrac_server_powerstate |
| 184 | vars: |
| 185 | hostname: "192.1.2.1" |
| 186 | username: "username" |
| 187 | password: "password" |
| 188 | ca_path: "/path/to/ca_cert.pem" |
| 189 | reset_type: "GracefulShutdown" |
| 190 | |
| 191 | - name: "Performing powercycle operation" |
| 192 | ansible.builtin.include_role: |
| 193 | name: idrac_server_powerstate |
| 194 | vars: |
| 195 | hostname: "192.1.2.1" |
| 196 | username: "username" |
| 197 | password: "password" |
| 198 | ca_path: "/path/to/ca_cert.pem" |
| 199 | reset_type: "PowerCycle" |
| 200 | |
| 201 | - name: "Performing push power button operation" |
| 202 | ansible.builtin.include_role: |
| 203 | name: idrac_server_powerstate |
| 204 | vars: |
| 205 | hostname: "192.1.2.1" |
| 206 | username: "username" |
| 207 | password: "password" |
| 208 | ca_path: "/path/to/ca_cert.pem" |
| 209 | reset_type: "PushPowerButton" |
| 210 | |
| 211 | - name: "Performing force restart operation" |
| 212 | ansible.builtin.include_role: |
| 213 | name: idrac_server_powerstate |
| 214 | vars: |
| 215 | hostname: "192.1.2.1" |
| 216 | username: "username" |
| 217 | password: "password" |
| 218 | ca_path: "/path/to/ca_cert.pem" |
| 219 | reset_type: "ForceRestart" |
| 220 | |
| 221 | - name: "Performing AC Power Cycle operation with final power state On" |
| 222 | ansible.builtin.include_role: |
| 223 | name: idrac_server_powerstate |
| 224 | vars: |
| 225 | hostname: "192.1.2.1" |
| 226 | username: "username" |
| 227 | password: "password" |
| 228 | ca_path: "/path/to/ca_cert.pem" |
| 229 | oem_reset_type: |
| 230 | dell: |
| 231 | final_power_state: "On" |
| 232 | reset_type: "PowerCycle" |
| 233 | |
| 234 | - name: "Performing AC Power Cycle operation with final power state Off" |
| 235 | ansible.builtin.include_role: |
| 236 | name: idrac_server_powerstate |
| 237 | vars: |
| 238 | hostname: "192.1.2.1" |
| 239 | username: "username" |
| 240 | password: "password" |
| 241 | ca_path: "/path/to/ca_cert.pem" |
| 242 | oem_reset_type: |
| 243 | dell: |
| 244 | final_power_state: "Off" |
| 245 | reset_type: "PowerCycle" |
| 246 | ``` |
| 247 | |
| 248 | ## Author Information |
| 249 | ------------------ |
| 250 | |
| 251 | Dell Technologies <br> |
| 252 | Kritika Bhateja ([email protected]) 2023 <br> |
| 253 | Lovepreet Singh ([email protected]) 2024 |