ansible.builtin.mattermost (v2.9.27) — module

Send Mattermost notifications

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

Authors: Benjamin Jolivot (@bjolivot)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Sends notifications to U(http://your.mattermost.url) via the Incoming WebHook integration.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Send notification message via Mattermost
  mattermost:
    url: http://mattermost.example.com
    api_key: my_api_key
    text: '{{ inventory_hostname }} completed'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Send notification message via Mattermost all options
  mattermost:
    url: http://mattermost.example.com
    api_key: my_api_key
    text: '{{ inventory_hostname }} completed'
    channel: notifications
    username: 'Ansible on {{ inventory_hostname }}'
    icon_url: http://www.example.com/some-image-file.png

Inputs

    
url:
    description:
    - Mattermost url (i.e. http://mattermost.yourcompany.com).
    required: true

text:
    description:
    - Text to send. Note that the module does not handle escaping characters.
    required: true

api_key:
    description:
    - Mattermost webhook api key. Log into your mattermost site, go to Menu -> Integration
      -> Incoming Webhook -> Add Incoming Webhook. This will give you full URL. api_key
      is the last part. http://mattermost.example.com/hooks/C(API_KEY)
    required: true

channel:
    description:
    - Channel to send the message to. If absent, the message goes to the channel selected
      for the I(api_key).

icon_url:
    default: https://www.ansible.com/favicon.ico
    description:
    - Url for the message sender's icon.

username:
    default: Ansible
    description:
    - This is the sender of the message (Username Override need to be enabled by mattermost
      admin, see mattermost doc.

validate_certs:
    default: true
    description:
    - If C(no), SSL certificates will not be validated. This should only be used on personally
      controlled sites using self-signed certificates.
    type: bool

Outputs

payload:
  description: Mattermost payload
  returned: success
  type: str
webhook_url:
  description: URL the webhook is sent to
  returned: success
  type: str