ansible.builtin.tower_notification (v2.9.24) — module

create, update, or destroy Ansible Tower notification.

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

Authors: Samuel Carpentier (@samcarpentier)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

Create, update, or destroy Ansible Tower 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
  tower_notification:
    name: slack notification
    notification_type: slack
    channels:
      - general
    token: cefda9e2be1f21d11cdd9452f5b7f97fda977f42
    state: present
    tower_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add email notification
  tower_notification:
    name: email notification
    notification_type: email
    username: user
    password: s3cr3t
    sender: tower@example.com
    recipients:
      - user1@example.com
    host: smtp.example.com
    port: 25
    use_tls: no
    use_ssl: no
    state: present
    tower_config_file: "~/tower_cli.cfg"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete notification
  tower_notification:
    name: old notification
    notification_type: email
    state: absent
    tower_config_file: "~/tower_cli.cfg"

Inputs

    
url:
    description:
    - The target URL. Required if I(notification_type=webhook).
    required: false

host:
    description:
    - The mail server host. Required if I(notification_type=email).
    required: false

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

port:
    description:
    - The mail server port. Required if I(notification_type=email) or if I(notification_type=irc).
    required: false

color:
    choices:
    - yellow
    - green
    - red
    - purple
    - gray
    - random
    description:
    - The notification color. Required if I(notification_type=hipchat).
    required: false

rooms:
    description:
    - HipChat rooms to send the notification to. Required if I(notification_type=hipchat).
    required: false
    type: list

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

token:
    description:
    - The access token. Required if I(notification_type=slack), if I(notification_type=pagerduty)
      or if I(notification_type=hipchat).
    required: false

notify:
    description:
    - The notify channel trigger. Required if I(notification_type=hipchat).
    required: false
    type: bool

sender:
    description:
    - The sender email address. Required if I(notification_type=email).
    required: false

server:
    description:
    - The IRC server address. Required if I(notification_type=irc).
    required: false

api_url:
    description:
    - The HipChat API URL. Required if I(notification_type=hipchat).
    required: false

headers:
    description:
    - The HTTP headers as JSON string. Required if I(notification_type=webhook).
    required: false

targets:
    description:
    - The destination channels or users. Required if I(notification_type=irc).
    required: false
    type: list

use_ssl:
    description:
    - The SSL trigger. Required if I(notification_type=email) or if I(notification_type=irc).
    required: false
    type: bool

use_tls:
    description:
    - The TLS trigger. Required if I(notification_type=email).
    required: false
    type: bool

channels:
    description:
    - The destination Slack channels. Required if I(notification_type=slack).
    required: false
    type: list

nickname:
    description:
    - The IRC nickname. Required if I(notification_type=irc).
    required: false

password:
    description:
    - The mail server password. Required if I(notification_type=email) or if I(notification_type=irc).
    required: false

username:
    description:
    - The mail server username. Required if I(notification_type=email).
    required: false

subdomain:
    description:
    - The PagerDuty subdomain. Required if I(notification_type=pagerduty).
    required: false

recipients:
    description:
    - The recipients email addresses. Required if I(notification_type=email).
    required: false

to_numbers:
    description:
    - The destination phone numbers. Required if I(notification_type=twillio).
    required: false

account_sid:
    description:
    - The Twillio account SID. Required if I(notification_type=twillio).
    required: false

client_name:
    description:
    - The PagerDuty client identifier. Required if I(notification_type=pagerduty).
    required: false

description:
    description:
    - The description of the notification.
    required: false

from_number:
    description:
    - The source phone number. Required if I(notification_type=twillio).
    required: false

service_key:
    description:
    - The PagerDuty service/integration API key. Required if I(notification_type=pagerduty).
    required: false

message_from:
    description:
    - The label to be shown with the notification. Required if I(notification_type=hipchat).
    required: false

organization:
    description:
    - The organization the notification belongs to.
    required: false

account_token:
    description:
    - The Twillio account token. Required if I(notification_type=twillio).
    required: false

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
    - slack
    - twilio
    - pagerduty
    - hipchat
    - webhook
    - irc
    description:
    - The type of notification to be sent.
    required: true

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: awx.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.
    required: false