�
�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
Z
d d l m Z m
Z
d Z y d d
l m Z Wn# e k
r� e
j � Z e Z n Xe Z d � 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#
---
author: "Jan Christian Grünhage (@jcgruenhage)"
module: matrix
short_description: Send notifications to matrix
description:
- This module sends html formatted notifications to matrix rooms.
version_added: "2.8"
options:
msg_plain:
description:
- Plain text form of the message to send to matrix, usually markdown
required: true
msg_html:
description:
- HTML form of the message to send to matrix
required: true
room_id:
description:
- ID of the room to send the notification to
required: true
hs_url:
description:
- URL of the homeserver, where the CS-API is reachable
required: true
token:
description:
- Authentication token for the API call. If provided, user_id and password are not required
user_id:
description:
- The user id of the user
password:
description:
- The password to log in with
requirements:
- matrix-client (Python library)
s
- name: Send matrix notification with token
matrix:
msg_plain: "**hello world**"
msg_html: "<b>hello world</b>"
room_id: "!12345678:server.tld"
hs_url: "https://matrix.org"
token: "{{ matrix_auth_token }}"
- name: Send matrix notification with user_id and password
matrix:
msg_plain: "**hello world**"
msg_html: "<b>hello world</b>"
room_id: "!12345678:server.tld"
hs_url: "https://matrix.org"
user_id: "ansible_notification_bot"
password: "{{ matrix_auth_password }}"
t
N( t
AnsibleModulet missing_required_lib( t MatrixClientc C` s� t d t d d d t � d t d d d t � d t d d 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 t d t � � } t d t d
d � } t d | d d d g g d d d g g d d
d g g d t � } t s$| j d t d � d t � n | j r1| St | j
d � } | j
d d k rm| j
d | j _
n$ | j | j
d
| j
d d t �| j | j
d � } | j | j
d | j
d � | j | � d S( Nt msg_plaint typet strt requiredt msg_htmlt room_idt hs_urlt tokent no_logt user_idt passwordt changedt messaget t
argument_spect mutually_exclusivet required_one_oft required_togethert supports_check_modet msgs
matrix-clientt exceptiont sync( t dictt Truet FalseR t matrix_foundt fail_jsonR
t MATRIX_IMP_ERRt
check_modeR t paramst Nonet apiR t logint join_roomt send_htmlt exit_json( t module_argst resultt modulet clientt room( ( sG /usr/lib/python2.7/site-packages/ansible/modules/notification/matrix.pyt
run_moduleY s8 $c C` s t � d S( N( R5 ( ( ( sG /usr/lib/python2.7/site-packages/ansible/modules/notification/matrix.pyt main� s t __main__( t
__future__R R R R
t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt RETURNt tracebackt ansible.module_utils.basicR R
R* R'