alancoding.awx.tower_notification (11.2.0) — module

create, update, or destroy Ansible Tower notification.

| "added in version" 2.8 of alancoding.awx"

Authors: Samuel Carpentier (@samcarpentier)

preview | supported by community

Install collection

Install with ansible-galaxy collection install alancoding.awx:==11.2.0


Add to requirements.yml

  collections:
    - name: alancoding.awx
      version: 11.2.0

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 with custom messages
  tower_notification:
    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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add webhook notification
  tower_notification:
    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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add email notification
  tower_notification:
    name: email notification
    notification_type: email
    notification_configuration:
      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
    notification_configuration:
      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
    notification_configuration:
      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
    notification_configuration:
      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
    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"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete notification
  tower_notification:
    name: old notification
    state: absent
    tower_config_file: "~/tower_cli.cfg"

Inputs

    
url:
    description:
    - The target URL.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

host:
    description:
    - The mail server host.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

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

port:
    description:
    - The mail server port.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: int

color:
    choices:
    - yellow
    - green
    - red
    - purple
    - gray
    - random
    description:
    - The notification color.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

rooms:
    description:
    - HipChat rooms to send the notification to.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    elements: str
    type: list

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

token:
    description:
    - The access token.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

notify:
    description:
    - The notify channel trigger.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: bool

sender:
    description:
    - The sender email address.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

server:
    description:
    - The IRC server address.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

api_url:
    description:
    - The HipChat API URL.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

headers:
    description:
    - The HTTP headers as JSON string.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: dict

targets:
    description:
    - The destination channels or users.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    elements: str
    type: list

use_ssl:
    description:
    - The SSL trigger.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: bool

use_tls:
    description:
    - The TLS trigger.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: bool

channels:
    description:
    - The destination Slack channels.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    elements: str
    type: list

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

nickname:
    description:
    - The IRC nickname.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

password:
    description:
    - The mail server password.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

username:
    description:
    - The mail server username.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

subdomain:
    description:
    - The PagerDuty subdomain.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

recipients:
    description:
    - The recipients email addresses.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    elements: str
    type: list

to_numbers:
    description:
    - The destination phone numbers.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    elements: str
    type: list

tower_host:
    description:
    - URL to your Tower or AWX instance.
    - If value not set, will try environment variable C(TOWER_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

account_sid:
    description:
    - The Twillio account SID.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

client_name:
    description:
    - The PagerDuty client identifier.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

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

from_number:
    description:
    - The source phone number.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

service_key:
    description:
    - The PagerDuty service/integration API key.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

message_from:
    description:
    - The label to be shown with the notification.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

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

account_token:
    description:
    - The Twillio account token.
    - This parameter has been deprecated, please use 'notification_configuration' instead.
    type: str

tower_password:
    description:
    - Password for your Tower or AWX instance.
    - If value not set, will try environment variable C(TOWER_PASSWORD) and then config
      files
    type: str

tower_username:
    description:
    - Username for your Tower or AWX instance.
    - If value not set, will try environment variable C(TOWER_USERNAME) and then config
      files
    type: str

validate_certs:
    aliases:
    - tower_verify_ssl
    description:
    - Whether to allow insecure connections to Tower or 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(TOWER_VERIFY_SSL) and then config
      files
    type: bool

tower_oauthtoken:
    description:
    - The Tower OAuth token to use.
    - If value not set, will try environment variable C(TOWER_OAUTH_TOKEN) and then config
      files
    type: str
    version_added: '3.7'
    version_added_collection: alancoding.awx

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

tower_config_file:
    description:
    - Path to the Tower or AWX config file.
    type: path

notification_configuration:
    description:
    - The notification configuration file. Note providing this field would disable all
      notification-configuration-related fields.
    type: dict