�
�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 d
l Z d
Z y* d d l m
Z
d d l m Z m Z Wn# e k
r� e j � Z e Z n Xe Z d d
l m Z 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�
---
author: "Willy Barro (@willybarro)"
requirements: [ pushbullet.py ]
module: pushbullet
short_description: Sends notifications to Pushbullet
description:
- This module sends push notifications via Pushbullet to channels or devices.
version_added: "2.0"
options:
api_key:
description:
- Push bullet API token
required: true
channel:
description:
- The channel TAG you wish to broadcast a push notification,
as seen on the "My Channels" > "Edit your channel" at
Pushbullet page.
device:
description:
- The device NAME you wish to send a push notification,
as seen on the Pushbullet main page.
push_type:
description:
- Thing you wish to push.
default: note
choices: [ "note", "link" ]
title:
description:
- Title of the notification.
required: true
body:
description:
- Body of the notification, e.g. Details of the fault you're alerting.
notes:
- Requires pushbullet.py Python package on the remote host.
You can install it via pip with ($ pip install pushbullet.py).
See U(https://github.com/randomchars/pushbullet.py)
sF
# Sends a push notification to a device
- pushbullet:
api_key: "ABC123abc123ABC123abc123ABC123ab"
device: "Chrome"
title: "You may see this on Google Chrome"
# Sends a link to a device
- pushbullet:
api_key: ABC123abc123ABC123abc123ABC123ab
device: Chrome
push_type: link
title: Ansible Documentation
body: https://docs.ansible.com/
# Sends a push notification to a channel
- pushbullet:
api_key: ABC123abc123ABC123abc123ABC123ab
channel: my-awesome-channel
title: Broadcasting a message to the #my-awesome-channel folks
# Sends a push notification with title and body to a channel
- pushbullet:
api_key: ABC123abc123ABC123abc123ABC123ab
channel: my-awesome-channel
title: ALERT! Signup service is down
body: Error rate on signup service is over 90% for more than 2 minutes
N( t
PushBullet( t InvalidKeyErrort PushError( t
AnsibleModulet missing_required_libc C` sS t d t d t d d d t d t � d t d d d d � d t d d d d � d
t d d d d d d d
g � d t d d d t � d t d d d d � d t d d d d � � d d d g f d t � } | j d } | j d } | j d } | j d
} | j d } | j d } | j d } t sL| j d t d � d t � n y t | � } d } Wn! t
k
r�| j d d � n X| d k r�| d k r�| j d d � n | d k r)i }
x | j D] } | |
| j <q�W| |
k r�|
| } q)| j d d | d j
|
j � � f � n | d k r�i } x | j D] }
|
| |
j <qEW| | k ru| | } q�| j d d | d j
| j � � f � n | j r�| j d t d d � n yL | d
k r�| j | | | � n | j | | � | j d t d d � Wn- t k
r>} | j d d t | � � n X| j d d � d S( Nt
argument_spect api_keyt typet strt requiredt no_logt channelt defaultt devicet push_typet notet choicest linkt titlet bodyt urlt mutually_exclusivet supports_check_modet msgs
pushbullet.pyt exceptions Invalid api_keys* You need to provide a channel or a device.s. Device '%s' not found. Available devices: '%s's ', 's0 Channel '%s' not found. Available channels: '%s't changedt OKs, An error occurred, Pushbullet's response: %ss An unknown error has occurred( R t dictt Truet Nonet paramst pushbullet_foundt fail_jsonR t PUSHBULLET_IMP_ERRR R t devicest nicknamet joint keyst channelst channel_tagt
check_modet exit_jsont Falset push_linkt push_noteR
R ( t moduleR R R R R R R t pbt targett devices_by_nicknamet dt channels_by_tagt ct e( ( sK /usr/lib/python2.7/site-packages/ansible/modules/notification/pushbullet.pyt mainj sf !
,
, t __main__( t
__future__R R R R t
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt tracebackR% R) t
pushbulletR t pushbullet.errorsR R
t ImportErrort
format_excR2 R'