dellemc.openmanage.ome_alert_policies module – Manage OME alert policies.

Note

This module is part of the dellemc.openmanage collection (version 8.7.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.ome_alert_policies.

New in dellemc.openmanage 8.3.0

Synopsis

  • This module allows you to create, modify, or delete alert policies on OpenManage Enterprise or OpenManage Enterprise Modular.

Requirements

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

  • python >= 3.9.6

Parameters

Parameter

Comments

actions

list / elements=dictionary

Actions to be triggered for the alert policy.

This parameter is case-sensitive.

This is mandatory for creating a policy and optional for updating a policy.

This is applicable only when state is present

action_name

string / required

Name of the action.

This is fetched from the dellemc.openmanage.ome_alert_policies_action_info.

This is mandatory for creating a policy and optional for updating a policy.

This parameter is case-sensitive.

parameters

list / elements=dictionary

Predefined parameters required to set for action_name.

Default: []

name

string

Name of the predefined parameter.

This is fetched from the dellemc.openmanage.ome_alert_policies_action_info.

value

string

Value of the predefined parameter.

These values will not be validated.

all_devices

boolean

This option indicates whether the alert policy is applicable to all the discovered and undiscovered devices or not.

This option is mutually exclusive with device_service_tag, specific_undiscovered_devices, any_undiscovered_devices and device_group.

This is applicable only when state is present.

Choices:

  • false

  • true

any_undiscovered_devices

boolean

This option indicates whether the alert policy is applicable to any undiscovered devices or not.

This option is mutually exclusive with device_service_tag, specific_undiscovered_devices, device_group and all_devices.

This is applicable only when state is present.

Choices:

  • false

  • true

ca_path

path

added in dellemc.openmanage 5.0.0

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

category

list / elements=dictionary

Category of the alerts received.

This is mutually exclusive with the message_ids, message_file.

This is fetched from the dellemc.openmanage.ome_alert_policies_category_info.

This is applicable only when state is present.

catalog_category

list / elements=dictionary

Category of the catalog.

category_name

string

Name of the category.

sub_category_names

list / elements=string

List of sub-categories.

catalog_name

string / required

Name of the catalog.

date_and_time

dictionary

Specifies the schedule for when the alert policy is applicable.

date_and_time is mandatory for creating a policy and optional when updating a policy.

This is applicable only when state is present.

date_from

string / required

Start date in the format YYYY-MM-DD.

This parameter to be provided in quotes.

date_to

string

End date in the format YYYY-MM-DD.

This parameter to be provided in quotes.

days

list / elements=string

Required days of the week on which alert policy operation must be scheduled.

Choices:

  • "monday"

  • "tuesday"

  • "wednesday"

  • "thursday"

  • "friday"

  • "saturday"

  • "sunday"

time_from

string

Interval start time in the format HH:MM

This parameter to be provided in quotes.

This is mandatory when time_interval is true.

time_interval

boolean

Enable the time interval for which alert policy must be scheduled.

Choices:

  • false

  • true

time_to

string

Interval end time in the format HH:MM

This parameter to be provided in quotes.

This is mandatory when time_interval is true

description

string

Description for the alert policy.

This is applicable only when state is present

device_group

list / elements=string

List of device group names on which the alert policy is applicable.

This option is mutually exclusive with device_service_tag, specific_undiscovered_devices, any_undiscovered_devices and all_devices .

This is applicable only when state is present

device_service_tag

list / elements=string

List of device service tags on which the alert policy will be applicable.

This option is mutually exclusive with device_group, specific_undiscovered_devices, any_undiscovered_devices and all_devices.

This is applicable only when state is present

enable

boolean

true allows you to enable an alert policy.

false allows you to disable an alert policy.

This is applicable only when state is present.

Choices:

  • false

  • true

hostname

string / required

OpenManage Enterprise or OpenManage Enterprise Modular IP address or hostname.

message_file

path

Local path of a CSV formatted file with message IDs

This is mutually exclusive with the category, message_ids

This is applicable only when state is present

This is fetched from the dellemc.openmanage.ome_alert_policies_message_id_info.

message_ids

list / elements=string

List of Message ids

This is mutually exclusive with the category, message_file

This is applicable only when state is present

This is fetched from the dellemc.openmanage.ome_alert_policies_message_id_info.

name

list / elements=string / required

Name of an alert policy or a list of alert policies.

More than one policy name is applicable when state is absent and state is present with only enable provided.

new_name

string

New name for the alert policy.

This is applicable only when state is present, and an alert policy exists.

password

string / required

OpenManage Enterprise or OpenManage Enterprise Modular password.

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

Example: export OME_PASSWORD=password

port

integer

OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port.

Default: 443

severity

list / elements=string

Severity of the alert policy.

This is mandatory for creating a policy and optional for updating a policy.

This is applicable only when state is present.

Choices:

  • "all"

  • "unknown"

  • "info"

  • "normal"

  • "warning"

  • "critical"

specific_undiscovered_devices

list / elements=string

List of undiscovered IPs, hostnames, or range of IPs of devices on which the alert policy is applicable.

This option is mutually exclusive with device_service_tag, device_group, any_undiscovered_devices and all_devices .

This is applicable only when state is present

Examples of valid IP range format:

10.35.0.0

10.36.0.0-10.36.0.255

10.37.0.0/24

2607:f2b1:f083:135::5500/118

2607:f2b1:f083:135::a500-2607:f2b1:f083:135::a600

hostname.domain.com

Examples of invalid IP range format:

10.35.0.*

10.36.0.0-255

10.35.0.0/255.255.255.0

These values will not be validated.

state

string

present allows you to create an alert policy or update if the policy name already exists.

absent allows you to delete an alert policy.

Choices:

  • "present" ← (default)

  • "absent"

timeout

integer

added in dellemc.openmanage 5.0.0

The socket level timeout in seconds.

Default: 30

username

string / required

OpenManage Enterprise or OpenManage Enterprise Modular username.

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

Example: export OME_USERNAME=username

validate_certs

boolean

added in dellemc.openmanage 5.0.0

If false, the SSL certificates will not be validated.

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

Prior to collection version 5.0.0, the validate_certs is false by default.

Choices:

  • false

  • true ← (default)

Notes

Note

  • Run this module from a system that has direct access to Dell OpenManage Enterprise or OpenManage Enterprise Modular.

  • This module supports IPv4 and IPv6 addresses.

  • This module supports check_mode.

Examples

---
- name: "Create an alert policy"
  dellemc.openamanage.ome_alert_policies:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name: "Alert Policy One"
    device_service_tag:
      - ABCD123
      - SVC7845
    category:
      - catalog_name: Application
        catalog_category:
          - category_name: Audit
            sub_category_names:
              - Generic
              - Devices
      - catalog_name: iDRAC
        catalog_category:
          - category_name: Audit
            sub_category_names:
              - BIOS Management
              - iDRAC Service Module
    date_and_time:
      date_from: "2023-10-10"
      date_to: "2023-10-11"
      time_from: "11:00"
      time_to: "12:00"
    severity:
      - unknown
      - critical
    actions:
      - action_name: Trap
        parameters:
          - name: "192.1.2.3:162"
            value: true
          - name: "traphostname.domain.com:162"
            value: true
  tags: create_alert_policy

- name: "Update an alert Policy"
  dellemc.openamanage.ome_alert_policies:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    new_name: "Update Policy Name"
    device_group: "Group Name"
    message_ids:
      - AMP400
      - CTL201
      - BIOS101
    date_and_time:
      date_from: "2023-10-10"
      date_to: "2023-10-11"
      time_from: "11:00"
      time_to: "12:00"
      time_interval: true
    actions:
      - action_name: Trap
        parameters:
          - name: "192.1.2.3:162"
            value: true
  tags: update_alert_policy

- name: "Enable an alert policy"
  dellemc.openamanage.ome_alert_policies:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name: "Policy Name"
    enable: true
  tags: enable_alert_policy

- name: "Disable multiple alert policies"
  dellemc.openamanage.ome_alert_policies:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name:
      - "Policy Name 1"
      - "Policy Name 2"
    enable: false
  tags: disable_alert_policy

- name: "Delete an alert policy"
  dellemc.openamanage.ome_alert_policies:
    hostname: "192.168.0.1"
    username: "username"
    password: "password"
    ca_path: "/path/to/ca_cert.pem"
    name:
      - "Policy Name"
    state: absent
  tags: delete_alert_policy

Return Values

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

Key

Description

error_info

dictionary

Details of the HTTP Error.

Returned: on HTTP error

Sample: {"error": {"@Message.ExtendedInfo": [{"Message": "Unable to create or modify the alert policy because an invalid value [To Email] is entered for the action Email.", "MessageArgs": ["[To Email]", "Email"], "MessageId": "CMON7011", "RelatedProperties": [], "Resolution": "Enter a valid value for the action identified in the message and retry the operation.", "Severity": "Warning"}], "code": "Base.1.0.GeneralError", "message": "A general error has occurred. See ExtendedInfo for more information."}}

msg

string

Status of the alert policies operation.

Returned: always

Sample: "Successfully created the alert policy."

status

dictionary

The policy which was created or modified.

Returned: when state is present

Sample: {"DefaultPolicy": false, "Description": "Details of the Policy", "Editable": true, "Enabled": true, "Id": 12345, "Name": "Policy", "PolicyData": {"Actions": [{"Id": 8, "Name": "Email", "ParameterDetails": [{"Id": 1, "Name": "subject", "Type": "string", "TypeParams": [{"Name": "maxLength", "Value": "255"}], "Value": "Device Name: $name,  Device IP Address: $ip,  Severity: $severity"}, {"Id": 1, "Name": "to", "Type": "string", "TypeParams": [{"Name": "maxLength", "Value": "255"}], "Value": "test@org.com"}, {"Id": 1, "Name": "from", "Type": "string", "TypeParams": [{"Name": "maxLength", "Value": "255"}], "Value": "abc@corp.com"}, {"Id": 1, "Name": "message", "Type": "string", "TypeParams": [{"Name": "maxLength", "Value": "255"}], "Value": "Event occurred for Device Name: $name, Device IP Address: $ip"}]}], "Catalogs": [{"CatalogName": "iDRAC", "Categories": [4], "SubCategories": [41]}, {"CatalogName": "Application", "Categories": [0], "SubCategories": [0]}], "DeviceTypes": [1000, 2000], "Devices": [10086, 10088], "Groups": [], "Owner": 10069, "Schedule": {"CronString": "* * * ? * * *", "EndTime": "2023-06-06 18:02:46.000", "StartTime": "2023-06-06 15:02:46.000"}, "Severities": [16, 1, 2, 4, 8], "State": true, "UndiscoveredTargets": []}, "Visible": true}

Authors

  • Jagadeesh N V(@jagadeeshnv)