vkhitrin.com

Technology And Ramblings

Controlling DellEMC iDRACs using Ansible



Tags: #Ansible #iDRAC

Tested on Ansible version 2.4.3.0 and iDRAC8 firmware version 2.50.50.50

DellEMC + Redfish API

Dell has included Redfish API support for their 12th Gen PowerEdge Servers (and newer) since firmware version 2.41.40.40 and upwards.

With the inclusion of Redfish API in iDRACs, Dell has also developed a Python SDK to control and operate DellEMC iDRACs based on Redfish API using their SDK called OpenManage Python SDK].
Based on the OpenManage Python SDK, Dell has developed Ansible modules utilizing the SDK called OpenManage Ansible Modules.

Official Support Matrix

Official documentation can be found in the git repository.

Dell OpenManage Python SDK (omsdk) supports Python 2.7 and above and requires Ansible version 2.2 or higher.

The Ansible modules were tested on several OSes by the OpenManage team:

The following iDRAC versions are supported:

Installing

Before continuing, make sure you have Ansible and Python installed on your Ansible controller.

Installing Dell EMC OpenManage Python SDK

pip install omsdk

Clone the OpenManage Ansible modules git repository and install the modules

git clone https://github.com/dell/Dell-EMC-Ansible-Modules-for-iDRAC.git
cd Dell-EMC-Ansible-Modules-for-iDRAC
python install.py

Verifying Compatability

To verify if your iDRACs support Redfish, make a REST API call to Redfish:

Using Shell

curl https://<idrac_hostname>/redfish/v1/Sessions -u username:password

If your iDRAC supports Redfish, the response should be similar to the following:

{"@odata.context":"/redfish/v1/$metadata#SessionCollection.SessionCollection","@odata.id":"/redfish/v1/Sessions","@odata.type":"#SessionCollection.SessionCollection","Description":"Session Collection","Members":[{"@odata.id":"/redfish/v1/Sessions/25"},{"@odata.id":"/redfish/v1/Sessions/18"}],"Members@odata.count":2,"Name":"Session Collection"}

If your iDRAC doesn’t support Redfish, the response will be “404 - Not Found”.

Using Ansible

There is no native module to verify compatibility, but we can use a REST API Ansible module:

- name: Check if you can authenticate with iDRAC
  uri:
    url: "https://{{ inventory_hostname}}/redfish/v1/Sessions"
    user: "{{ idrac_user }}"
    password: "{{ idrac_pass }}"
    force_basic_auth: yes
    validate_certs: no # Optional

The responses should be exactly as the curl queries.

Supported Actions In OpenManage Ansible Modules

For a user guide, visit the project’s git repository ^[OpenManage Ansible Modules User Guide].

The following modules are part of the OpenManage ansible modules:

ansible-doc -l | grep -i idrac
# Output
dellemc_configure_idrac_eventing          Configures the iDRAC eventing attributes.
dellemc_configure_idrac_network           Configures the iDRAC network attributes.
dellemc_configure_idrac_services          Configures the iDRAC services attributes.
dellemc_configure_idrac_timezone          Configures the iDRAC timezone attributes.
dellemc_configure_idrac_users             Configures the iDRAC users attributes.
dellemc_idrac_lc_attributes               Enable or disable Collect System Inventory on Restart (CSIOR) property for all iDRAC/LC jobs.
dellemc_idrac_reset                       Reset iDRAC.
dellemc_setup_idrac_syslog                syslog parameters

Example

Example of how to invoke power cycle actions with an Ansible task:

- name: Performing Power Action "{{ power_action }}"
  dellemc_change_power_state:
    idrac_ip: "{{ inventory_hostname }}" # The iDRAC IP address
    idrac_port: "{{ idrac_port }}" # The iDRAC HTTP/HTTPS port, by default, 443
    idrac_user: "{{ idrac_user }}" # iDRAC user
    idrac_pwd: "{{ idrac_pass }}" # iDRAC user's password
    change_power: "{{ power_action }}" # One of the following actions: 'On','ForceOff','GracefulRestart','GracefulShutdown','PushPowerButton','Nmi'

Back To Top