awx.awx.notification_template – create, update, or destroy Automation Platform Controller notification.

Note

This plugin is part of the awx.awx collection (version 19.2.2).

To install it use: ansible-galaxy collection install awx.awx.

To use it in a playbook, specify: awx.awx.notification_template.

Synopsis

Parameters

Parameter Choices/Defaults Comments
account_sid
string
The Twillio account SID.
This parameter has been deprecated, please use 'notification_configuration' instead.
account_token
string
The Twillio account token.
This parameter has been deprecated, please use 'notification_configuration' instead.
channels
list / elements=string
The destination Slack channels.
This parameter has been deprecated, please use 'notification_configuration' instead.
client_name
string
The PagerDuty client identifier.
This parameter has been deprecated, please use 'notification_configuration' instead.
color
string
    Choices:
  • yellow
  • green
  • red
  • purple
  • gray
  • random
The notification color.
This parameter has been deprecated, please use 'notification_configuration' instead.
controller_config_file
path
Path to the controller config file.
If provided, the other locations for config files will not be considered.

aliases: tower_config_file
controller_host
string
URL to your Automation Platform Controller instance.
If value not set, will try environment variable CONTROLLER_HOST and then config files
If value not specified by any means, the value of 127.0.0.1 will be used

aliases: tower_host
controller_oauthtoken
raw
added in 3.7.0 of awx.awx
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 CONTROLLER_OAUTH_TOKEN and then config files

aliases: tower_oauthtoken
controller_password
string
Password for your controller instance.
If value not set, will try environment variable CONTROLLER_PASSWORD and then config files

aliases: tower_password
controller_username
string
Username for your controller instance.
If value not set, will try environment variable CONTROLLER_USERNAME and then config files

aliases: tower_username
copy_from
string
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.
description
string
The description of the notification.
from_number
string
The source phone number.
This parameter has been deprecated, please use 'notification_configuration' instead.
headers
dictionary
The HTTP headers as JSON string.
This parameter has been deprecated, please use 'notification_configuration' instead.
host
string
The mail server host.
This parameter has been deprecated, please use 'notification_configuration' instead.
message_from
string
The label to be shown with the notification.
This parameter has been deprecated, please use 'notification_configuration' instead.
messages
dictionary
Optional custom messages for notification template.
name
string / required
The name of the notification.
new_name
string
Setting this option will change the existing name (looked up via the name field.
nickname
string
The IRC nickname.
This parameter has been deprecated, please use 'notification_configuration' instead.
notification_configuration
dictionary
The notification configuration file. Note providing this field would disable all notification-configuration-related fields.
notification_type
string
    Choices:
  • email
  • grafana
  • irc
  • mattermost
  • pagerduty
  • rocketchat
  • slack
  • twilio
  • webhook
The type of notification to be sent.
notify
boolean
    Choices:
  • no
  • yes
The notify channel trigger.
This parameter has been deprecated, please use 'notification_configuration' instead.
organization
string
The organization the notification belongs to.
password
string
The mail server password.
This parameter has been deprecated, please use 'notification_configuration' instead.
port
integer
The mail server port.
This parameter has been deprecated, please use 'notification_configuration' instead.
recipients
list / elements=string
The recipients email addresses.
This parameter has been deprecated, please use 'notification_configuration' instead.
sender
string
The sender email address.
This parameter has been deprecated, please use 'notification_configuration' instead.
server
string
The IRC server address.
This parameter has been deprecated, please use 'notification_configuration' instead.
service_key
string
The PagerDuty service/integration API key.
This parameter has been deprecated, please use 'notification_configuration' instead.
state
string
    Choices:
  • present ←
  • absent
Desired state of the resource.
subdomain
string
The PagerDuty subdomain.
This parameter has been deprecated, please use 'notification_configuration' instead.
targets
list / elements=string
The destination channels or users.
This parameter has been deprecated, please use 'notification_configuration' instead.
to_numbers
list / elements=string
The destination phone numbers.
This parameter has been deprecated, please use 'notification_configuration' instead.
token
string
The access token.
This parameter has been deprecated, please use 'notification_configuration' instead.
url
string
The target URL.
This parameter has been deprecated, please use 'notification_configuration' instead.
use_ssl
boolean
    Choices:
  • no
  • yes
The SSL trigger.
This parameter has been deprecated, please use 'notification_configuration' instead.
use_tls
boolean
    Choices:
  • no
  • yes
The TLS trigger.
This parameter has been deprecated, please use 'notification_configuration' instead.
username
string
The mail server username.
This parameter has been deprecated, please use 'notification_configuration' instead.
validate_certs
boolean
    Choices:
  • no
  • yes
Whether to allow insecure connections to AWX.
If 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 CONTROLLER_VERIFY_SSL and then config files

aliases: tower_verify_ssl

Notes

Note

  • If no config_file is provided we will attempt to use the tower-cli library defaults to find your host information.

  • config_file should be in the following format host=hostname username=username password=password

Examples

- 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"

- 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"

- name: Add email notification
  notification_template:
    name: email notification
    notification_type: email
    notification_configuration:
      username: user
      password: s3cr3t
      sender: [email protected]
      recipients:
        - [email protected]
      host: smtp.example.com
      port: 25
      use_tls: no
      use_ssl: no
    state: present
    controller_config_file: "~/tower_cli.cfg"

- 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"

- 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"

- 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"

- name: Delete notification
  notification_template:
    name: old notification
    state: absent
    controller_config_file: "~/tower_cli.cfg"

- name: Copy webhook notification
  notification_template:
    name: foo notification
    copy_from: email notification
    organization: Foo

Authors

  • Samuel Carpentier (@samcarpentier)