PARALLAX

mattermost

Send notifications through Mattermost webhooks

Collection: community.general

Full Name: community.general.mattermost

Synopsis

Send notifications through Mattermost webhooks

Parameters

NameTypeRequiredDefaultDescription
api_keystringyesMattermost webhook API key. Log into your Mattermost site, go to Menu -> Integration -> Incoming Webhook -> Add Incoming Webhook. This gives you a full URL. O(api_key) is the last part. U(http://mattermost.example.com/hooks/API_KEY).
attachmentslistDefine a list of attachments. For more information, see U(https://developers.mattermost.com/integrate/admin-guide/admin-message-attachments/). Required when O(text) is not set.
channelstringChannel to send the message to. If absent, the message goes to the channel selected for the O(api_key).
icon_urlstringhttps://docs.ansible.com/favicon/favicon.icoURL for the message sender’s icon.
prioritystringSet a priority for the message.
textstringText to send. Note that the module does not handle escaping characters. Required when O(attachments) is not set.
urlstringyesMattermost URL (for example V(http://mattermost.yourcompany.com)).
usernamestringAnsibleThis is the sender of the message (Username Override need to be enabled by mattermost admin, see mattermost doc).
validate_certsbooltrueIf V(false), SSL certificates are not validated. This should only be used on personally controlled sites using self-signed certificates.

Example

yaml
- name: Send notification message via Mattermost
  community.general.mattermost:
    url: http://mattermost.example.com
    api_key: my_api_key
    text: '{{ inventory_hostname }} completed'

- name: Send notification message via Mattermost all options
  community.general.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
    priority: important

- name: Send attachments message via Mattermost
  community.general.mattermost:
    url: http://mattermost.example.com
    api_key: my_api_key
    attachments:
        - text: Display my system load on host A and B
          color: '#ff00dd'
          title: System load
          fields:
            - title: System A
              value: "load average: 0,74, 0,66, 0,63"
              short: true
            - title: System B
              value: 'load average: 5,16, 4,64, 2,43'
              short: true
Search
    ↑ ↓ move↵ openesc close