Published: September 06, 2018
Updated: January 30, 2019
Tags: Ansible, iDRAC
2 min read

Controlling DellEMC iDRACs using Ansible

Tested on Ansible version 2.4.3.0 and iDRAC8 firmware version 2.50.50.50 with RHEL7.5

DellEMC + Redfish API

Dell has included Redfish API [1] 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 own SDK called "OpenManage Python SDK" [2]. Based on the OpenManage Python SDK, Dell has developed Ansible modules utilizing the SDK called "OpenManage Ansible Modules" [3].

Official Support matrix

Official documentation can be found in the project's git repository [4].

Dell OpenManage Python SDK (omsdk) is supporting 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:

  • RHEL(7.3)
  • SLES 12SP3

The following iDRAC versions are supported:
iDRAC8 - 2.41.40.40 and 2.50.50.50
iDRAC9 - 3.00.00.00, 3.15.15.15 and 3.17.17.17

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:

{"@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 comptability, but we can use a REST API Ansible module:

- name: Check if 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 exact as the curl queries.

Supported actions in OpenManage Ansible modules

For a user guide, visit the project's git repository [5].

The following modules are part of the OpenManage ansible modules:

ansible-doc -l | grep -i idrac
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'

To see how I use OpenManage Ansilbe modules in real world scenarios as part of automation workflow, view my playbook [6].


  1. Redfish API ↩︎

  2. OpenManage Python SDK GitHub Project ↩︎

  3. OpenManage Ansible Modules GitHub Project ↩︎

  4. OpenManage Ansible Modules Installation Guide ↩︎

  5. OpenManage Ansible Modules User Guide ↩︎

  6. Gerrit Code Review - Dell iDRAC patch ↩︎