Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/notification/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/notification/mqtt.pyc

�
�Udac@`s)ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	dd
l
Z
dd
lZdd
lZddl
mZeZd
Zy"dd
lZdd
ljjZWn#ek
r�ej�ZeZnXddlmZmZdd
lmZd�Ze dkr%e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: mqtt
short_description: Publish a message on an MQTT topic for the IoT
version_added: "1.2"
description:
   - Publish a message on an MQTT topic.
options:
  server:
    description:
      - MQTT broker address/name
    default: localhost
  port:
    description:
      - MQTT broker port number
    default: 1883
  username:
    description:
      - Username to authenticate against the broker.
  password:
    description:
      - Password for C(username) to authenticate against the broker.
  client_id:
    description:
      - MQTT client identifier
    default: hostname + pid
  topic:
    description:
      - MQTT topic name
    required: true
  payload:
    description:
      - Payload. The special string C("None") may be used to send a NULL
        (i.e. empty) payload which is useful to simply notify with the I(topic)
        or to clear previously retained messages.
    required: true
  qos:
    description:
      - QoS (Quality of Service)
    default: 0
    choices: [ "0", "1", "2" ]
  retain:
    description:
      - Setting this flag causes the broker to retain (i.e. keep) the message so that
        applications that subsequently subscribe to the topic can received the last
        retained message immediately.
    type: bool
    default: 'no'
  ca_cert:
    description:
      - The path to the Certificate Authority certificate files that are to be
        treated as trusted by this client. If this is the only option given
        then the client will operate in a similar manner to a web browser. That
        is to say it will require the broker to have a certificate signed by the
        Certificate Authorities in ca_certs and will communicate using TLS v1,
        but will not attempt any form of authentication. This provides basic
        network encryption but may not be sufficient depending on how the broker
        is configured.
    version_added: 2.3
    aliases: [ ca_certs ]
  client_cert:
    description:
      - The path pointing to the PEM encoded client certificate. If this is not
        None it will be used as client information for TLS based
        authentication. Support for this feature is broker dependent.
    version_added: 2.3
    aliases: [ certfile ]
  client_key:
    description:
      - The path pointing to the PEM encoded client private key. If this is not
        None it will be used as client information for TLS based
        authentication. Support for this feature is broker dependent.
    version_added: 2.3
    aliases: [ keyfile ]
  tls_version:
    description:
      - Specifies the version of the SSL/TLS protocol to be used.
      - By default (if the python version supports it) the highest TLS version is
        detected. If unavailable, TLS v1 is used.
    type: str
    choices:
      - tlsv1.1
      - tlsv1.2
    version_added: 2.9
requirements: [ mosquitto ]
notes:
 - This module requires a connection to an MQTT broker such as Mosquitto
   U(http://mosquitto.org) and the I(Paho) C(mqtt) Python client (U(https://pypi.org/project/paho-mqtt/)).
author: "Jan-Piet Mens (@jpmens)"
s�
- mqtt:
    topic: 'service/ansible/{{ ansible_hostname }}'
    payload: 'Hello at {{ ansible_date_time.iso8601 }}'
    qos: 0
    retain: False
    client_id: ans001
  delegate_to: localhost
N(tLooseVersion(t
AnsibleModuletmissing_required_lib(t	to_nativec"C`s4i}ytj|d<Wntk
r*nXytj|d<Wntk
rOnXtdtdtdd�dtddd	d
�dtdt�d
tdt�dtdd�dtddddddg�dtdtd	d�dtdd�dtdddt�dtddd	dddg�dtddd	dddg�dtddd	ddd g�d!tdddddg��
d"t�}t	s�|j
d#td$�d%t�n|j
jdd�}|j
jdd�}|j
jd�}|j
jd
�}|j
jdd&�}t|j
jdd'��}|j
jd�}|j
jdd�}	|j
jdd�}
|j
jdd�}|j
jdd�}|j
jdd�}
|j
jd!d�}|dkr�d(tj�tj�f}n|r�|d)kr�d}nd}|	dk	r'i|	d6|
d6}nd}|dk	r�|rW|j|tj�}n$ttj��d*kr{tj}ni|d6|d6|
d 6|d!6}ny>tj||d|d|d|d+|d|d,|d-|�Wn9tk
r}|j
d#d.t|�d%tj��nX|jd/td|�dS(0Nstlsv1.2stlsv1.1t
argument_spectservertdefaultt	localhosttporti[ttypetintttopictrequiredtpayloadt	client_idtqost0tchoicest1t2tretaintbooltusernametpasswordtno_logtca_certtpathtaliasestca_certstclient_certtcertfilet
client_keytkeyfilettls_versiontsupports_check_modetmsgs	paho-mqttt	exceptiontis%s_%stNones3.5.2thostnametauthttlss#unable to publish to MQTT broker %stchanged(tssltPROTOCOL_TLSv1_2tAttributeErrortPROTOCOL_TLSv1_1R	tdicttTrueR.tFalsetHAS_PAHOMQTTt	fail_jsonR
tPAHOMQTT_IMP_ERRtparamstgetRtsockettgetfqdntostgetpidtPROTOCOL_SSLv23Rtplatformtpython_versiontmqtttsinglet	ExceptionRt	tracebackt
format_exct	exit_json(ttls_maptmoduleR
RRRRRRRRR$R&R(R)R0R1te((sE/usr/lib/python2.7/site-packages/ansible/modules/notification/mqtt.pytmain�s�

		
	t__main__(!t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESRAR3RIRDtdistutils.versionRR8R:R.R<R?tpaho.mqtt.publishRFtpublishtImportErrorRJR9tansible.module_utils.basicR	R
tansible.module_utils._textRROt__name__(((sE/usr/lib/python2.7/site-packages/ansible/modules/notification/mqtt.pyt<module>s0


\


	e

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