�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
d
� Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
module: mattermost
short_description: Send Mattermost notifications
description:
- Sends notifications to U(http://your.mattermost.url) via the Incoming WebHook integration.
version_added: "2.3"
author: "Benjamin Jolivot (@bjolivot)"
options:
url:
description:
- Mattermost url (i.e. http://mattermost.yourcompany.com).
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
text:
description:
- Text to send. Note that the module does not handle escaping characters.
required: true
channel:
description:
- Channel to send the message to. If absent, the message goes to the channel selected for the I(api_key).
username:
description:
- This is the sender of the message (Username Override need to be enabled by mattermost admin, see mattermost doc.
default: Ansible
icon_url:
description:
- Url for the message sender's icon.
default: https://www.ansible.com/favicon.ico
validate_certs:
description:
- If C(no), SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates.
default: yes
type: bool
s�
- name: Send notification message via Mattermost
mattermost:
url: http://mattermost.example.com
api_key: my_api_key
text: '{{ inventory_hostname }} completed'
- 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
s�
payload:
description: Mattermost payload
returned: success
type: str
webhook_url:
description: URL the webhook is sent to
returned: success
type: str
( t
AnsibleModule( t fetch_urlc C` s� t d t d t d t d d d t � d t d d d t d t � d t d d d t � d
t d d d d � d t d d d d
� d t d d d d � d t d d d d � � � } t d t d d � } d j | j d | j d � } | | d <i } xA d d
d d g D]- } | j | d k r | j | | | <q q W| j | � } | | d <i d d 6d d 6} | j t k r�t d | d | d | d d d | � \ } } | d! d"