tower_notification – create, update, or destroy Ansible Tower notification¶
New in version 2.8.
Synopsis¶
Create, update, or destroy Ansible Tower notifications. See https://www.ansible.com/tower for an overview.
Requirements¶
The below requirements are needed on the host that executes this module.
ansible-tower-cli >= 3.0.2
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
account_sid
-
|
The Twillio account SID. Required if notification_type=twillio.
|
|
account_token
-
|
The Twillio account token. Required if notification_type=twillio.
|
|
api_url
-
|
The HipChat API URL. Required if notification_type=hipchat.
|
|
channels
list
|
The destination Slack channels. Required if notification_type=slack.
|
|
client_name
-
|
The PagerDuty client identifier. Required if notification_type=pagerduty.
|
|
color
-
|
|
The notification color. Required if notification_type=hipchat.
|
description
-
|
The description of the notification.
|
|
from_number
-
|
The source phone number. Required if notification_type=twillio.
|
|
headers
-
|
The HTTP headers as JSON string. Required if notification_type=webhook.
|
|
host
-
|
The mail server host. Required if notification_type=email.
|
|
message_from
-
|
The label to be shown with the notification. Required if notification_type=hipchat.
|
|
name
-
/ required
|
The name of the notification.
|
|
nickname
-
|
The IRC nickname. Required if notification_type=irc.
|
|
notification_configuration
-
|
The notification configuration file. Note providing this field would disable all notification-configuration-related fields.
|
|
notification_type
-
/ required
|
|
The type of notification to be sent.
|
notify
boolean
|
|
The notify channel trigger. Required if notification_type=hipchat.
|
organization
-
|
The organization the notification belongs to.
|
|
password
-
|
The mail server password. Required if notification_type=email or if notification_type=irc.
|
|
port
-
|
The mail server port. Required if notification_type=email or if notification_type=irc.
|
|
recipients
-
|
The recipients email addresses. Required if notification_type=email.
|
|
rooms
list
|
HipChat rooms to send the notification to. Required if notification_type=hipchat.
|
|
sender
-
|
The sender email address. Required if notification_type=email.
|
|
server
-
|
The IRC server address. Required if notification_type=irc.
|
|
service_key
-
|
The PagerDuty service/integration API key. Required if notification_type=pagerduty.
|
|
state
-
|
|
Desired state of the resource.
|
subdomain
-
|
The PagerDuty subdomain. Required if notification_type=pagerduty.
|
|
targets
list
|
The destination channels or users. Required if notification_type=irc.
|
|
to_numbers
-
|
The destination phone numbers. Required if notification_type=twillio.
|
|
token
-
|
The access token. Required if notification_type=slack, if notification_type=pagerduty or if notification_type=hipchat.
|
|
tower_config_file
path
|
Path to the Tower config file.
|
|
tower_host
string
|
URL to your Tower instance.
|
|
tower_password
string
|
Password for your Tower instance.
|
|
tower_username
string
|
Username for your Tower instance.
|
|
url
-
|
The target URL. Required if notification_type=webhook.
|
|
use_ssl
boolean
|
|
The SSL trigger. Required if notification_type=email or if notification_type=irc.
|
use_tls
boolean
|
|
The TLS trigger. Required if notification_type=email.
|
username
-
|
The mail server username. Required if notification_type=email.
|
|
validate_certs
boolean
|
|
Whether to allow insecure connections to Tower.
If
no , SSL certificates will not be validated.This should only be used on personally controlled sites using self-signed certificates.
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 Tower host information.
config_file should contain Tower configuration in the following format host=hostname username=username password=password
Examples¶
- name: Add Slack notification
tower_notification:
name: slack notification
notification_type: slack
channels:
- general
token: cefda9e2be1f21d11cdd9452f5b7f97fda977f42
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add webhook notification
tower_notification:
name: webhook notification
notification_type: webhook
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:
name: email notification
notification_type: email
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:
name: twilio notification
notification_type: twilio
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:
name: pagerduty notification
notification_type: pagerduty
token: a_token
subdomain: sub
client_name: client
service_key: a_key
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add HipChat notification
tower_notification:
name: hipchat notification
notification_type: hipchat
token: a_token
message_from: user1
api_url: https://hipchat.example.com
color: red
rooms:
- room-A
notify: yes
state: present
tower_config_file: "~/tower_cli.cfg"
- name: Add IRC notification
tower_notification:
name: irc notification
notification_type: irc
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:
name: old notification
notification_type: email
state: absent
tower_config_file: "~/tower_cli.cfg"
Status¶
This module is not guaranteed to have a backwards compatible interface. [preview]
This module is maintained by the Ansible Community. [community]