From 723556fc98a77a1c02f7be77c79e9a36a9bca0d9 Mon Sep 17 00:00:00 2001 From: Fabio Alessandro Locati Date: Fri, 2 Dec 2016 15:09:20 +0000 Subject: [PATCH] Native YAML - notification leftovers (#3626) --- .../modules/extras/notification/jabber.py | 18 +++---- .../modules/extras/notification/mail.py | 47 ++++++++++--------- 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/lib/ansible/modules/extras/notification/jabber.py b/lib/ansible/modules/extras/notification/jabber.py index d881d28132..d9fa001515 100644 --- a/lib/ansible/modules/extras/notification/jabber.py +++ b/lib/ansible/modules/extras/notification/jabber.py @@ -66,16 +66,18 @@ author: "Brian Coca (@bcoca)" EXAMPLES = ''' # send a message to a user -- jabber: user=mybot@example.net - password=secret - to=friend@example.net - msg="Ansible task finished" +- jabber: + user: mybot@example.net + password: secret + to: friend@example.net + msg: Ansible task finished # send a message to a room -- jabber: user=mybot@example.net - password=secret - to=mychaps@conference.example.net/ansiblebot - msg="Ansible task finished" +- jabber: + user: mybot@example.net + password: secret + to: mychaps@conference.example.net/ansiblebot + msg: Ansible task finished # send a message, specifying the host and port - jabber diff --git a/lib/ansible/modules/extras/notification/mail.py b/lib/ansible/modules/extras/notification/mail.py index 5cab0d3584..fbbdcff267 100644 --- a/lib/ansible/modules/extras/notification/mail.py +++ b/lib/ansible/modules/extras/notification/mail.py @@ -120,35 +120,40 @@ options: EXAMPLES = ''' # Example playbook sending mail to root -- local_action: mail subject='System {{ ansible_hostname }} has been successfully provisioned.' +- mail: + subject: 'System {{ ansible_hostname }} has been successfully provisioned.' + delegate_to: localhost # Sending an e-mail using Gmail SMTP servers -- local_action: mail - host='smtp.gmail.com' - port=587 - username=username@gmail.com - password='mysecret' - to="John Smith " - subject='Ansible-report' - body='System {{ ansible_hostname }} has been successfully provisioned.' +- mail: + host: smtp.gmail.com + port: 587 + username: username@gmail.com + password: mysecret + to: John Smith + subject: Ansible-report + body: 'System {{ ansible_hostname }} has been successfully provisioned.' + delegate_to: localhost # Send e-mail to a bunch of users, attaching files -- local_action: mail - host='127.0.0.1' - port=2025 - subject="Ansible-report" - body="Hello, this is an e-mail. I hope you like it ;-)" - from="jane@example.net (Jane Jolie)" - to="John Doe , Suzie Something " - cc="Charlie Root " - attach="/etc/group /tmp/pavatar2.png" - headers=Reply-To=john@example.com|X-Special="Something or other" - charset=utf8 +- mail: + host: 127.0.0.1 + port: 2025 + subject: Ansible-report + body: Hello, this is an e-mail. I hope you like it ;-) + from: jane@example.net (Jane Jolie) + to: John Doe , Suzie Something + cc: Charlie Root + attach: /etc/group /tmp/pavatar2.png + headers: 'Reply-To=john@example.com|X-Special="Something or other"' + charset: utf8 + delegate_to: localhost + # Sending an e-mail using the remote machine, not the Ansible controller node - mail: host: localhost port: 25 - to: 'John Smith ' + to: John Smith subject: Ansible-report body: 'System {{ ansible_hostname }} has been successfully provisioned.' '''