shanemcd.awx.notification_template (20.0.14) — module

create, update, or destroy Automation Platform Controller notification.

Authors: Samuel Carpentier (@samcarpentier)

preview | supported by community

Install collection

Install with ansible-galaxy collection install shanemcd.awx:==20.0.14


Add to requirements.yml

  collections:
    - name: shanemcd.awx
      version: 20.0.14

Description

Create, update, or destroy Automation Platform Controller notifications. See U(https://www.ansible.com/tower) for an overview.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add Slack notification with custom messages
  notification_template:
    name: slack notification
    organization: Default
    notification_type: slack
    notification_configuration:
      channels:
        - general
      token: cefda9e2be1f21d11cdd9452f5b7f97fda977f42
    messages:
       started:
         message: "{{ '{{ job_friendly_name }}{{ job.id }} started' }}"
       success:
         message: "{{ '{{ job_friendly_name }} completed in {{ job.elapsed }} seconds' }}"
       error:
         message: "{{ '{{ job_friendly_name }} FAILED! Please look at {{ job.url }}' }}"
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add webhook notification
  notification_template:
    name: webhook notification
    notification_type: webhook
    notification_configuration:
      url: http://www.example.com/hook
      headers:
        X-Custom-Header: value123
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add email notification
  notification_template:
    name: email notification
    notification_type: email
    notification_configuration:
      username: user
      password: s3cr3t
      sender: controller@example.com
      recipients:
        - user1@example.com
      host: smtp.example.com
      port: 25
      use_tls: no
      use_ssl: no
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add twilio notification
  notification_template:
    name: twilio notification
    notification_type: twilio
    notification_configuration:
      account_token: a_token
      account_sid: a_sid
      from_number: '+15551112222'
      to_numbers:
        - '+15553334444'
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add PagerDuty notification
  notification_template:
    name: pagerduty notification
    notification_type: pagerduty
    notification_configuration:
      token: a_token
      subdomain: sub
      client_name: client
      service_key: a_key
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add IRC notification
  notification_template:
    name: irc notification
    notification_type: irc
    notification_configuration:
      nickname: controller
      password: s3cr3t
      targets:
        - user1
      port: 8080
      server: irc.example.com
      use_ssl: no
    state: present
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete notification
  notification_template:
    name: old notification
    state: absent
    controller_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Copy webhook notification
  notification_template:
    name: foo notification
    copy_from: email notification
    organization: Foo

Inputs

    
name:
    description:
    - The name of the notification.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Desired state of the resource.
    type: str

messages:
    description:
    - Optional custom messages for notification template.
    type: dict

new_name:
    description:
    - Setting this option will change the existing name (looked up via the name field.
    type: str

copy_from:
    description:
    - Name or id to copy the notification from.
    - This will copy an existing notification and change any parameters supplied.
    - The new notification name will be the one provided in the name parameter.
    - The organization parameter is not used in this, to facilitate copy from one organization
      to another.
    - Provide the id or use the lookup plugin to provide the id if multiple notifications
      share the same name.
    type: str

description:
    description:
    - The description of the notification.
    type: str

organization:
    description:
    - The organization the notification belongs to.
    type: str

validate_certs:
    aliases:
    - tower_verify_ssl
    description:
    - Whether to allow insecure connections to AWX.
    - If C(no), SSL certificates will not be validated.
    - This should only be used on personally controlled sites using self-signed certificates.
    - If value not set, will try environment variable C(CONTROLLER_VERIFY_SSL) and then
      config files
    type: bool

controller_host:
    aliases:
    - tower_host
    description:
    - URL to your Automation Platform Controller instance.
    - If value not set, will try environment variable C(CONTROLLER_HOST) and then config
      files
    - If value not specified by any means, the value of C(127.0.0.1) will be used
    type: str

notification_type:
    choices:
    - email
    - grafana
    - irc
    - mattermost
    - pagerduty
    - rocketchat
    - slack
    - twilio
    - webhook
    description:
    - The type of notification to be sent.
    type: str

controller_password:
    aliases:
    - tower_password
    description:
    - Password for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then
      config files
    type: str

controller_username:
    aliases:
    - tower_username
    description:
    - Username for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then
      config files
    type: str

controller_oauthtoken:
    aliases:
    - tower_oauthtoken
    description:
    - The OAuth token to use.
    - This value can be in one of two formats.
    - A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX)
    - A dictionary structure as returned by the token module.
    - If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then
      config files
    type: raw
    version_added: 3.7.0
    version_added_collection: shanemcd.awx

controller_config_file:
    aliases:
    - tower_config_file
    description:
    - Path to the controller config file.
    - If provided, the other locations for config files will not be considered.
    type: path

notification_configuration:
    description:
    - The notification configuration file. Note providing this field would disable all
      notification-configuration-related fields.
    - username (the mail server username)
    - sender (the sender email address)
    - recipients (the recipients email addresses)
    - use_tls (the TLS trigger)
    - host (the mail server host)
    - use_ssl (the SSL trigger)
    - password (the mail server password)
    - port (the mail server port)
    - channels (the destination Slack channels)
    - token (the access token)
    - account_token (the Twillio account token)
    - from_number (the source phone number)
    - to_numbers (the destination phone numbers)
    - account_sid (the Twillio account SID)
    - subdomain (the PagerDuty subdomain)
    - service_key (the PagerDuty service/integration API key)
    - client_name (the PagerDuty client identifier)
    - message_from (the label to be shown with the notification)
    - color (the notification color)
    - notify (the notify channel trigger)
    - url (the target URL)
    - headers (the HTTP headers as JSON string)
    - server (the IRC server address)
    - nickname (the IRC nickname)
    - targets (the destination channels or users)
    type: dict