dellemc.openmanage.idrac_session_info module – Query iDRAC session information

Note

This module is part of the dellemc.openmanage collection (version 11.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install dellemc.openmanage. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: dellemc.openmanage.idrac_session_info.

New in dellemc.openmanage 9.13.0

Synopsis

  • This module queries active iDRAC sessions, session service configuration, and session limits with utilization reporting.

  • Supports client-side filtering by session type, username, and stale threshold.

  • This module is read-only and does not modify any state on the iDRAC.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.9.6

Parameters

Parameter

Comments

ca_path

path

The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for the validation.

cert_fingerprint

string

SHA-256 fingerprint of the expected TLS certificate (hex digest, with or without colons).

When supplied together with validate_certs=false, the module verifies the remote certificate’s fingerprint instead of performing full CA validation.

enforce_validate_certs

boolean

If true and validate_certs is false, the module will fail with an error instead of just emitting a warning.

Choices:

  • false ← (default)

  • true

idrac_ip

string / required

iDRAC IP Address.

idrac_password

aliases: idrac_pwd

string / required

iDRAC user password.

If the password is not provided, then the environment variable IDRAC_PASSWORD is used.

idrac_port

integer

iDRAC port.

Default: 443

idrac_user

string / required

iDRAC username.

If the username is not provided, then the environment variable IDRAC_USERNAME is used.

session_type

string

Filter sessions by DMTF SessionType enum value.

Case-insensitive matching.

Valid values include Redfish, IPMI, OEM, WebUI, etc.

Choices:

  • "Redfish"

  • "IPMI"

  • "OEM"

  • "WebUI"

  • "VirtualMedia"

  • "KVMIP"

stale_threshold_minutes

integer

Flag sessions older than the specified number of minutes as stale.

Must be a positive integer.

Session age is computed from CreatedTime; this is a proxy for idle time as iDRAC Redfish has no LastAccessedTime.

timeout

integer

The socket level timeout in seconds.

Default: 30

username_filter

string

Filter sessions by username substring match.

Case-insensitive matching.

validate_certs

boolean

If false, the SSL certificates will not be validated.

Configure false only on personally controlled sites where self-signed certificates are used.

Choices:

  • false

  • true ← (default)

Notes

Note

  • Run this module from a system that has direct access to Dell iDRAC.

  • This module supports IPv4 and IPv6 addresses.

  • This module supports check_mode.

  • Minimum firmware requirements - iDRAC9 >= 7.10.90.00, iDRAC10 >= 1.20.50.50.

  • Session age is computed from CreatedTime and is a proxy for idle time.

  • Output is structured JSON via exit_json(). To export as CSV or text, use Ansible native filters (to_json, to_nice_yaml) or Jinja2 templates.

Examples

---
- name: Query all active iDRAC sessions
  dellemc.openmanage.idrac_session_info:
    idrac_ip: 198.162.0.1
    idrac_user: admin
    idrac_password: password
    ca_path: "/path/to/ca_cert.pem"

- name: Filter sessions by type
  dellemc.openmanage.idrac_session_info:
    idrac_ip: 198.162.0.1
    idrac_user: admin
    idrac_password: password
    session_type: Redfish

- name: Find stale sessions older than 24 hours
  dellemc.openmanage.idrac_session_info:
    idrac_ip: 198.162.0.1
    idrac_user: admin
    idrac_password: password
    stale_threshold_minutes: 1440

- name: Filter sessions by username
  dellemc.openmanage.idrac_session_info:
    idrac_ip: 198.162.0.1
    idrac_user: admin
    idrac_password: password
    username_filter: root

- name: Combined filtering
  dellemc.openmanage.idrac_session_info:
    idrac_ip: 198.162.0.1
    idrac_user: admin
    idrac_password: password
    session_type: Redfish
    username_filter: admin
    stale_threshold_minutes: 60

- name: Export session data to CSV file using Jinja2 template
  block:
    - name: Query sessions
      dellemc.openmanage.idrac_session_info:
        idrac_ip: 198.162.0.1
        idrac_user: admin
        idrac_password: password
      register: result

    - name: Write CSV report
      ansible.builtin.copy:
        content: |
          Id,UserName,SessionType,ClientOriginIPAddress,CreatedTime,AgeMinutes
          {% for s in result.sessions %}
          {{ s.Id }},{{ s.UserName }},{{ s.SessionType }},{{ s.ClientOriginIPAddress }},{{ s.CreatedTime }},{{ s.session_age_minutes }}
          {% endfor %}
        dest: /tmp/session_report.csv
      delegate_to: localhost

- name: Display session data as YAML
  block:
    - name: Query sessions
      dellemc.openmanage.idrac_session_info:
        idrac_ip: 198.162.0.1
        idrac_user: admin
        idrac_password: password
      register: result

    - name: Show sessions in YAML format
      ansible.builtin.debug:
        msg: "{{ result.sessions | to_nice_yaml }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

msg

string

Status of the session query operation.

Returned: always

Sample: "Successfully retrieved session information."

session_count

integer

Number of sessions returned (after filtering).

Returned: success

Sample: 2

session_limits

dictionary

Session limits and utilization.

Returned: success

Sample: {"active_sessions": 2, "max_sessions": 8, "utilization_percent": 25.0}

session_service

dictionary

Session service configuration.

Returned: success

Sample: {"service_enabled": true, "session_timeout": 1800}

sessions

list / elements=dictionary

List of active sessions with details.

Returned: success

Sample: [{"client_origin_ip": "192.168.1.10", "created_time": "2024-07-28T10:00:00+00:00", "description": "User Session", "id": "1", "is_stale": false, "session_age_minutes": 30, "session_type": "Redfish", "username": "root"}]

Authors

  • Saksham Nautiyal (@Saksham-Nautiyal)