# idrac_server_powerstate Role to to manage the different power states of the specified device using iDRACs (iDRAC8 and iDRAC9 only) for Dell PowerEdge servers. ## Requirements ### Development Requirements to develop and contribute to the role. ``` ansible docker molecule python ``` ### Production Requirements to use the role. ``` ansible python ``` ### Ansible collections Collections required to use the role ``` dellemc.openmanage ``` ## Role Variables
Name Required Default Value Choices Type Description
hostname true str - iDRAC IP Address
username true str - iDRAC username
password true str - iDRAC user password.
https_port false 443 int - iDRAC port.
validate_certs false true bool - If C(false), the SSL certificates will not be validated.
- Configure C(false) only on personally controlled sites where self-signed certificates are used.
ca_path false path - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.
https_timeout false 30 int - The HTTPS socket level timeout in seconds.
resource_id false str - This option is the unique identifier of the device being managed. For example, U(https:///redfish/v1/Systems/).
- This option is mandatory for I(base_uri) with multiple devices.
- To get the device details, use the API U(https:///redfish/v1/Systems) for reset_type operation and U(https:///redfish/v1/Chassis) for oem_reset_type operation.
reset_type false ["ForceOff", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown", "Nmi", "On", "PowerCycle", "PushPowerButton"] str - This option resets the device.
- C(ForceOff) turns off the device immediately.
- C(ForceOn) turns on the device immediately.
- C(ForceRestart) turns off the device immediately, and then restarts the server.
- C(GracefulRestart) performs graceful shutdown of the device, and then restarts the device.
- C(GracefulShutdown) performs a graceful shutdown of the device, and then turns off the device.
- C(Nmi) sends a diagnostic interrupt to the device. This option is usually a nonmaskable interrupt (NMI) on x86 systems.
- C(On) turns on the device.
- C(PowerCycle) performs a power cycle on the device.
- C(PushPowerButton) simulates the pressing of a physical power button on the device.
- I(reset_type) is mutually exclusive with I(oem_reset_type).
- 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.
oem_reset_type false dict - This parameter initiates a complete Alternate Current (AC) power cycle of the server which is equivalent to disconnecting power cables using OEM API.
- I(oem_reset_type) is mutually exclusive with I(reset_type).
- If the value of 'final_power_state' is not provided, the default value is 'Off'.
## Fact variables
Name Sample Description
idrac_server_powerstate_out {"changed": true, "failed": false, "msg": "Successfully performed the reset type operation 'GracefulRestart'." } Module output of the powercycle contol
## Examples ----- ``` - name: "Performing force off operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "ForceOff" - name: "Performing power on operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "On" - name: "Performing graceful restart operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "GracefulRestart" - name: "Performing graceful shutdown operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "GracefulShutdown" - name: "Performing powercycle operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "PowerCycle" - name: "Performing push power button operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "PushPowerButton" - name: "Performing force restart operation" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" reset_type: "ForceRestart" - name: "Performing AC Power Cycle operation with final power state On" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" oem_reset_type: dell: final_power_state: "On" reset_type: "PowerCycle" - name: "Performing AC Power Cycle operation with final power state Off" ansible.builtin.include_role: name: idrac_server_powerstate vars: hostname: "192.1.2.1" username: "username" password: "password" ca_path: "/path/to/ca_cert.pem" oem_reset_type: dell: final_power_state: "Off" reset_type: "PowerCycle" ``` ## Author Information ------------------ Dell Technologies
Kritika Bhateja (Kritika.Bhateja@Dell.com) 2023
Lovepreet Singh (lovepreet.singh1@dell.com) 2024