From a034f19a4143c6b52c8c7ebbde86f9f0f4118479 Mon Sep 17 00:00:00 2001 From: kovacsbalu Date: Tue, 15 Sep 2015 09:35:14 +0200 Subject: [PATCH] Use push_type and send link with push_link. --- lib/ansible/modules/extras/notification/pushbullet.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/notification/pushbullet.py b/lib/ansible/modules/extras/notification/pushbullet.py index 5cd75f8e04c..5ea34f9a53a 100644 --- a/lib/ansible/modules/extras/notification/pushbullet.py +++ b/lib/ansible/modules/extras/notification/pushbullet.py @@ -113,7 +113,8 @@ def main(): device = dict(type='str', default=None), push_type = dict(type='str', default="note", choices=['note', 'link']), title = dict(type='str', required=True), - body = dict(type='str', default=None) + body = dict(type='str', default=None), + url = dict(type='str', default=None), ), mutually_exclusive = ( ['channel', 'device'], @@ -127,6 +128,7 @@ def main(): push_type = module.params['push_type'] title = module.params['title'] body = module.params['body'] + url = module.params['url'] if not pushbullet_found: module.fail_json(msg="Python 'pushbullet.py' module is required. Install via: $ pip install pushbullet.py") @@ -170,7 +172,10 @@ def main(): # Send push notification try: - target.push_note(title, body) + if push_type == "link": + target.push_link(title, url, body) + else: + target.push_note(title, body) module.exit_json(changed=False, msg="OK") except PushError as e: module.fail_json(msg="An error occurred, Pushbullet's response: %s" % str(e))