awx.awx.tower_notification_template – create, update, or destroy Ansible Tower notification.
Note
This plugin is part of the awx.awx collection (version 17.0.1).
To install it use: ansible-galaxy collection install awx.awx.
To use it in a playbook, specify: awx.awx.tower_notification_template.
Synopsis
- Create, update, or destroy Ansible Tower notifications. See https://www.ansible.com/tower for an overview.
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 |
| The notification color. This parameter has been deprecated, please use 'notification_configuration' instead. |
| 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 |
| The type of notification to be sent. |
| notify boolean |
| 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 |
| 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. | |
| tower_config_file path | Path to the Tower or AWX config file. If provided, the other locations for config files will not be considered. | |
| tower_host string | URL to your Tower or AWX instance. If value not set, will try environment variable TOWER_HOST and then config filesIf value not specified by any means, the value of 127.0.0.1 will be used | |
| tower_oauthtoken raw added in 3.7 of awx.awx | The Tower 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 tower_token module. If value not set, will try environment variable TOWER_OAUTH_TOKEN and then config files | |
| tower_password string | Password for your Tower or AWX instance. If value not set, will try environment variable TOWER_PASSWORD and then config files | |
| tower_username string | Username for your Tower or AWX instance. If value not set, will try environment variable TOWER_USERNAME and then config files | |
| url string | The target URL. This parameter has been deprecated, please use 'notification_configuration' instead. | |
| use_ssl boolean |
| The SSL trigger. This parameter has been deprecated, please use 'notification_configuration' instead. |
| use_tls boolean |
| 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 |
| Whether to allow insecure connections to Tower or 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 TOWER_VERIFY_SSL and then config filesaliases: tower_verify_ssl |
Notes
Note
- If no config_file is provided we will attempt to use the tower-cli library defaults to find your Tower host information.
- config_file should contain Tower configuration in the following format host=hostname username=username password=password
Examples
- name: Add Slack notification with custom messages
tower_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
tower_config_file: "~/tower_cli.cfg"
- name: Add webhook notification
tower_notification_template:
name: webhook notification
notification_type: webhook
notification_configuration:
url: http://www.example.com/hook
headers:
X-Custom-Header: value123
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add email notification
tower_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
tower_config_file: "~/tower_cli.cfg"
- name: Add twilio notification
tower_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
tower_config_file: "~/tower_cli.cfg"
- name: Add PagerDuty notification
tower_notification_template:
name: pagerduty notification
notification_type: pagerduty
notification_configuration:
token: a_token
subdomain: sub
client_name: client
service_key: a_key
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add IRC notification
tower_notification_template:
name: irc notification
notification_type: irc
notification_configuration:
nickname: tower
password: s3cr3t
targets:
- user1
port: 8080
server: irc.example.com
use_ssl: no
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Delete notification
tower_notification_template:
name: old notification
state: absent
tower_config_file: "~/tower_cli.cfg"
Authors
- Samuel Carpentier (@samcarpentier)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/awx/awx/tower_notification_template_module.html