dellemc.openmanage.ome_alert_policies (9.1.0) — module

Manage OME alert policies.

| "added in version" 8.3.0 of dellemc.openmanage"

Authors: Jagadeesh N V(@jagadeeshnv)

Install collection

Install with ansible-galaxy collection install dellemc.openmanage:==9.1.0


Add to requirements.yml

  collections:
    - name: dellemc.openmanage
      version: 9.1.0

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - Name of an alert policy or a list of alert policies.
    - More than one policy name is applicable when I(state) is C(absent) and I(state)
      is C(present) with only I(enable) provided.
    elements: str
    required: true
    type: list

port:
    default: 443
    description: OpenManage Enterprise or OpenManage Enterprise Modular HTTPS port.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - C(present) allows you to create an alert policy or update if the policy name already
      exists.
    - C(absent) allows you to delete an alert policy.
    type: str

enable:
    description:
    - C(true) allows you to enable an alert policy.
    - C(false) allows you to disable an alert policy.
    - This is applicable only when I(state) is C(present).
    type: bool

actions:
    description:
    - 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 I(state) is C(present)
    elements: dict
    suboptions:
      action_name:
        description:
        - Name of the action.
        - This is fetched from the M(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.
        required: true
        type: str
      parameters:
        default: []
        description:
        - Predefined parameters required to set for I(action_name).
        elements: dict
        suboptions:
          name:
            description:
            - Name of the predefined parameter.
            - This is fetched from the M(dellemc.openmanage.ome_alert_policies_action_info).
            type: str
          value:
            description:
            - Value of the predefined parameter.
            - These values will not be validated.
            type: str
        type: list
    type: list

ca_path:
    description:
    - The Privacy Enhanced Mail (PEM) file that contains a CA certificate to be used for
      the validation.
    type: path
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

timeout:
    default: 30
    description: The socket level timeout in seconds.
    type: int
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

category:
    description:
    - Category of the alerts received.
    - This is mutually exclusive with the I(message_ids), I(message_file).
    - This is fetched from the M(dellemc.openmanage.ome_alert_policies_category_info).
    - This is applicable only when I(state) is C(present).
    elements: dict
    suboptions:
      catalog_category:
        description: Category of the catalog.
        elements: dict
        suboptions:
          category_name:
            description: Name of the category.
            type: str
          sub_category_names:
            description: List of sub-categories.
            elements: str
            type: list
        type: list
      catalog_name:
        description: Name of the catalog.
        required: true
        type: str
    type: list

hostname:
    description: OpenManage Enterprise or OpenManage Enterprise Modular IP address or
      hostname.
    required: true
    type: str

new_name:
    description:
    - New name for the alert policy.
    - This is applicable only when I(state) is C(present), and an alert policy exists.
    type: str

password:
    description:
    - OpenManage Enterprise or OpenManage Enterprise Modular password.
    - If the password is not provided, then the environment variable C(OME_PASSWORD) is
      used.
    - 'Example: export OME_PASSWORD=password'
    required: true
    type: str

severity:
    choices:
    - all
    - unknown
    - info
    - normal
    - warning
    - critical
    description:
    - Severity of the alert policy.
    - This is mandatory for creating a policy and optional for updating a policy.
    - This is applicable only when I(state) is C(present).
    elements: str
    type: list

username:
    description:
    - OpenManage Enterprise or OpenManage Enterprise Modular username.
    - If the username is not provided, then the environment variable C(OME_USERNAME) is
      used.
    - 'Example: export OME_USERNAME=username'
    required: true
    type: str

all_devices:
    description:
    - This option indicates whether the alert policy is applicable to all the discovered
      and undiscovered devices or not.
    - This option is mutually exclusive with I(device_service_tag), I(specific_undiscovered_devices),
      I(any_undiscovered_devices) and I(device_group).
    - This is applicable only when I(state) is C(present).
    type: bool

description:
    description:
    - Description for the alert policy.
    - This is applicable only when I(state) is C(present)
    type: str

message_ids:
    description:
    - List of Message ids
    - This is mutually exclusive with the I(category), I(message_file)
    - This is applicable only when I(state) is C(present)
    - This is fetched from the M(dellemc.openmanage.ome_alert_policies_message_id_info).
    elements: str
    type: list

device_group:
    description:
    - List of device group names on which the alert policy is applicable.
    - This option is mutually exclusive with I(device_service_tag), I(specific_undiscovered_devices),
      I(any_undiscovered_devices) and I(all_devices) .
    - This is applicable only when I(state) is C(present)
    elements: str
    type: list

message_file:
    description:
    - Local path of a CSV formatted file with message IDs
    - This is mutually exclusive with the I(category), I(message_ids)
    - This is applicable only when I(state) is C(present)
    - This is fetched from the M(dellemc.openmanage.ome_alert_policies_message_id_info).
    type: path

date_and_time:
    description:
    - Specifies the schedule for when the alert policy is applicable.
    - I(date_and_time) is mandatory for creating a policy and optional when updating a
      policy.
    - This is applicable only when I(state) is C(present).
    suboptions:
      date_from:
        description:
        - Start date in the format YYYY-MM-DD.
        - This parameter to be provided in quotes.
        required: true
        type: str
      date_to:
        description:
        - End date in the format YYYY-MM-DD.
        - This parameter to be provided in quotes.
        type: str
      days:
        choices:
        - monday
        - tuesday
        - wednesday
        - thursday
        - friday
        - saturday
        - sunday
        description: Required days of the week on which alert policy operation must be
          scheduled.
        elements: str
        type: list
      time_from:
        description:
        - Interval start time in the format HH:MM
        - This parameter to be provided in quotes.
        - This is mandatory when I(time_interval) is C(true).
        type: str
      time_interval:
        description: Enable the time interval for which alert policy must be scheduled.
        type: bool
      time_to:
        description:
        - Interval end time in the format HH:MM
        - This parameter to be provided in quotes.
        - This is mandatory when I(time_interval) is C(true)
        type: str
    type: dict

validate_certs:
    default: true
    description:
    - If C(false), the SSL certificates will not be validated.
    - Configure C(false) only on personally controlled sites where self-signed certificates
      are used.
    - Prior to collection version C(5.0.0), the I(validate_certs) is C(false) by default.
    type: bool
    version_added: 5.0.0
    version_added_collection: dellemc.openmanage

device_service_tag:
    description:
    - List of device service tags on which the alert policy will be applicable.
    - This option is mutually exclusive with I(device_group), I(specific_undiscovered_devices),
      I(any_undiscovered_devices) and I(all_devices).
    - This is applicable only when I(state) is C(present)
    elements: str
    type: list

any_undiscovered_devices:
    description:
    - This option indicates whether the alert policy is applicable to any undiscovered
      devices or not.
    - This option is mutually exclusive with I(device_service_tag), I(specific_undiscovered_devices),
      I(device_group) and I(all_devices).
    - This is applicable only when I(state) is C(present).
    type: bool

specific_undiscovered_devices:
    description:
    - List of undiscovered IPs, hostnames, or range of IPs of devices on which the alert
      policy is applicable.
    - This option is mutually exclusive with I(device_service_tag), I(device_group), I(any_undiscovered_devices)
      and I(all_devices) .
    - This is applicable only when I(state) is C(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.
    elements: str
    type: list

Outputs

error_info:
  description: 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.
  type: dict
msg:
  description: Status of the alert policies operation.
  returned: always
  sample: Successfully created the alert policy.
  type: str
status:
  description: 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
  type: dict