ansible.builtin.manageiq_alerts (v2.9.27) — module

Configuration of alerts in ManageIQ

| "added in version" 2.5 of ansible.builtin"

Authors: Elad Alfassa (@elad661) <ealfassa@redhat.com

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

The manageiq_alerts module supports adding, updating and deleting alerts in ManageIQ.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add an alert with a "hash expression" to ManageIQ
  manageiq_alerts:
    state: present
    description: Test Alert 01
    options:
      notifications:
        email:
          to: ["example@example.com"]
          from: "example@example.com"
    resource_type: ContainerNode
    expression:
        eval_method: hostd_log_threshold
        mode: internal
        options: {}
    enabled: true
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add an alert with a "miq expression" to ManageIQ
  manageiq_alerts:
    state: present
    description: Test Alert 02
    options:
      notifications:
        email:
          to: ["example@example.com"]
          from: "example@example.com"
    resource_type: Vm
    expression_type: miq
    expression:
        and:
          - CONTAINS:
              tag: Vm.managed-environment
              value: prod
          - not:
            CONTAINS:
              tag: Vm.host.managed-environment
              value: prod
    enabled: true
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete an alert from ManageIQ
  manageiq_alerts:
    state: absent
    description: Test Alert 01
    manageiq_connection:
      url: 'http://127.0.0.1:3000'
      username: 'admin'
      password: 'smartvm'
      validate_certs: False

Inputs

    
state:
    choices:
    - absent
    - present
    default: present
    description:
    - absent - alert should not exist,
    - present - alert should exist,
    required: false

enabled:
    description:
    - Enable or disable the alert. Required if state is "present".
    type: bool

options:
    description:
    - Additional alert options, such as notification type and frequency

expression:
    description:
    - The alert expression for ManageIQ.
    - Can either be in the "Miq Expression" format or the "Hash Expression format".
    - Required if state is "present".

description:
    description:
    - The unique alert description in ManageIQ.
    - Required when state is "absent" or "present".

resource_type:
    choices:
    - Vm
    - ContainerNode
    - MiqServer
    - Host
    - Storage
    - EmsCluster
    - ExtManagementSystem
    - MiddlewareServer
    description:
    - The entity type for the alert in ManageIQ. Required when state is "present".

expression_type:
    choices:
    - hash
    - miq
    default: hash
    description:
    - Expression type.

manageiq_connection:
    description:
    - ManageIQ connection configuration information.
    required: false
    suboptions:
      ca_cert:
        aliases:
        - ca_bundle_path
        description:
        - The path to a CA bundle file or directory with certificates. defaults to None.
        type: str
      password:
        description:
        - ManageIQ password. C(MIQ_PASSWORD) env var if set. otherwise, required if no
          token is passed in.
        type: str
      token:
        description:
        - ManageIQ token. C(MIQ_TOKEN) env var if set. otherwise, required if no username
          or password is passed in.
        type: str
      url:
        description:
        - ManageIQ environment url. C(MIQ_URL) env var if set. otherwise, it is required
          to pass it.
        required: false
        type: str
      username:
        description:
        - ManageIQ username. C(MIQ_USERNAME) env var if set. otherwise, required if no
          token is passed in.
        type: str
      validate_certs:
        aliases:
        - verify_ssl
        default: true
        description:
        - Whether SSL certificates should be verified for HTTPS requests. defaults to
          True.
        type: bool
    type: dict