Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/modules/notification/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/modules/notification/rocketchat.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
d
Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
module: rocketchat
short_description: Send notifications to Rocket Chat
description:
    - The C(rocketchat) module sends notifications to Rocket Chat via the Incoming WebHook integration
version_added: "2.2"
author: "Ramon de la Fuente (@ramondelafuente)"
options:
  domain:
    description:
      - The domain for your environment without protocol. (i.e.
        C(example.com) or C(chat.example.com))
    required: true
  token:
    description:
      - Rocket Chat Incoming Webhook integration token.  This provides
        authentication to Rocket Chat's Incoming webhook for posting
        messages.
    required: true
  protocol:
    description:
      - Specify the protocol used to send notification messages before the webhook url. (i.e. http or https)
    default: https
    choices:
      - 'http'
      - 'https'
  msg:
    description:
      - Message to be sent.
  channel:
    description:
      - Channel to send the message to. If absent, the message goes to the channel selected for the I(token)
        specified during the creation of webhook.
  username:
    description:
      - This is the sender of the message.
    default: "Ansible"
  icon_url:
    description:
      - URL for the message sender's icon.
    default: "https://www.ansible.com/favicon.ico"
  icon_emoji:
    description:
      - Emoji for the message sender. The representation for the available emojis can be
        got from Rocket Chat. (for example :thumbsup:) (if I(icon_emoji) is set, I(icon_url) will not be used)
  link_names:
    description:
      - Automatically create links for channels and usernames in I(msg).
    default: 1
    choices:
      - 1
      - 0
  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.
    type: bool
    default: 'yes'
  color:
    description:
      - Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message
    default: 'normal'
    choices:
      - 'normal'
      - 'good'
      - 'warning'
      - 'danger'
  attachments:
    description:
      - Define a list of attachments.
s�
- name: Send notification message via Rocket Chat
  rocketchat:
    token: thetoken/generatedby/rocketchat
    domain: chat.example.com
    msg: '{{ inventory_hostname }} completed'
  delegate_to: localhost

- name: Send notification message via Rocket Chat all options
  rocketchat:
    domain: chat.example.com
    token: thetoken/generatedby/rocketchat
    msg: '{{ inventory_hostname }} completed'
    channel: #ansible
    username: 'Ansible on {{ inventory_hostname }}'
    icon_url: http://www.example.com/some-image-file.png
    link_names: 0
  delegate_to: localhost

- name: insert a color bar in front of the message for visibility purposes and use the default webhook icon and name configured in rocketchat
  rocketchat:
    token: thetoken/generatedby/rocketchat
    domain: chat.example.com
    msg: '{{ inventory_hostname }} is alive!'
    color: good
    username: ''
    icon_url: ''
  delegate_to: localhost

- name: Use the attachments API
  rocketchat:
    token: thetoken/generatedby/rocketchat
    domain: chat.example.com
    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
  delegate_to: localhost
s�
changed:
    description: A flag indicating if any change was made or not.
    returned: success
    type: bool
    sample: false
(t
AnsibleModule(t	fetch_urls%s://%s/hooks/%sc	C`s�i}	|dkr0|dk	r0td|�}	n0|dk	r`tdtd|d|�g�}	n|dk	r�|ddks�|ddkr�||	d<q�d||	d<n|dk	r�||	d	<n|dk	r�||	d
<n
||	d<|dk	r�||	d<n|dk	r'd|	kr'g|	d<q'n|dk	rux?|D]4}
d
|
kr]|
d|
d
<n|	dj|
�q:Wnd|j|	�}	|	S(Ntnormalttexttattachmentstcolorit#t@tchanneltusernamet
icon_emojiticon_urlt
link_namestfallbackspayload=(tNonetdicttappendtjsonify(tmoduleRRRRRRR
Rtpayloadt
attachment((sK/usr/lib/python2.7/site-packages/ansible/modules/notification/rocketchat.pytbuild_payload_for_rocketchat�s4$ 





cC`s�|jd�dkr(|jdd�nt|||f}t||d|�\}}|ddkr�|jddt|d��ndS(	Nt/itmsgs.Invalid Token specified, provide a valid tokentdataRi�s(failed to send message, return status=%s(tcountt	fail_jsontROCKETCHAT_INCOMING_WEBHOOKR	tstr(RtdomainttokentprotocolRtrocketchat_incoming_webhooktresponsetinfo((sK/usr/lib/python2.7/site-packages/ansible/modules/notification/rocketchat.pytdo_notify_rocketchat�sc
"C`s-tdtdtdddtdd�dtdddtdt�d	tdddd
ddd
g�d
tdddtdd�dtdddd�dtdddd�dtdddd�dtdddd�dtdddddddg�dtdddd�dtdddddddddg�d tdd!dtdd���}|jd}|jd}|jd	}|jd
}|jd}|jd}|jd}|jd}|jd}	|jd}
|jd }t|||||||	|
|�	}t|||||�|jd
d"�dS(#Nt
argument_specR%ttypeR$trequiredtdefaultR&tno_logR'thttpstchoicesthttpRRRtAnsibleRs#https://www.ansible.com/favicon.icoRRtintiitvalidate_certstyestboolR
R
tgoodtwarningtdangerRtlisttOK(	RRtTrueRtFalsetparamsRR+t	exit_json(
RR%R&R'RRRRRRR
RR((sK/usr/lib/python2.7/site-packages/ansible/modules/notification/rocketchat.pytmain�s8!!'!










$t__main__N(t
__future__RRRR-t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils.urlsR	R#RR+RBt__name__(((sK/usr/lib/python2.7/site-packages/ansible/modules/notification/rocketchat.pyt<module>
s


I/	"		$

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]