|
|
@ -120,35 +120,40 @@ options:
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
# Example playbook sending mail to root
|
|
|
|
# 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
|
|
|
|
# Sending an e-mail using Gmail SMTP servers
|
|
|
|
- local_action: mail
|
|
|
|
- mail:
|
|
|
|
host='smtp.gmail.com'
|
|
|
|
host: smtp.gmail.com
|
|
|
|
port=587
|
|
|
|
port: 587
|
|
|
|
username=username@gmail.com
|
|
|
|
username: username@gmail.com
|
|
|
|
password='mysecret'
|
|
|
|
password: mysecret
|
|
|
|
to="John Smith <john.smith@example.com>"
|
|
|
|
to: John Smith <john.smith@example.com>
|
|
|
|
subject='Ansible-report'
|
|
|
|
subject: Ansible-report
|
|
|
|
body='System {{ ansible_hostname }} has been successfully provisioned.'
|
|
|
|
body: 'System {{ ansible_hostname }} has been successfully provisioned.'
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Send e-mail to a bunch of users, attaching files
|
|
|
|
# Send e-mail to a bunch of users, attaching files
|
|
|
|
- local_action: mail
|
|
|
|
- mail:
|
|
|
|
host='127.0.0.1'
|
|
|
|
host: 127.0.0.1
|
|
|
|
port=2025
|
|
|
|
port: 2025
|
|
|
|
subject="Ansible-report"
|
|
|
|
subject: Ansible-report
|
|
|
|
body="Hello, this is an e-mail. I hope you like it ;-)"
|
|
|
|
body: Hello, this is an e-mail. I hope you like it ;-)
|
|
|
|
from="jane@example.net (Jane Jolie)"
|
|
|
|
from: jane@example.net (Jane Jolie)
|
|
|
|
to="John Doe <j.d@example.org>, Suzie Something <sue@example.com>"
|
|
|
|
to: John Doe <j.d@example.org>, Suzie Something <sue@example.com>
|
|
|
|
cc="Charlie Root <root@localhost>"
|
|
|
|
cc: Charlie Root <root@localhost>
|
|
|
|
attach="/etc/group /tmp/pavatar2.png"
|
|
|
|
attach: /etc/group /tmp/pavatar2.png
|
|
|
|
headers=Reply-To=john@example.com|X-Special="Something or other"
|
|
|
|
headers: 'Reply-To=john@example.com|X-Special="Something or other"'
|
|
|
|
charset=utf8
|
|
|
|
charset: utf8
|
|
|
|
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
# Sending an e-mail using the remote machine, not the Ansible controller node
|
|
|
|
# Sending an e-mail using the remote machine, not the Ansible controller node
|
|
|
|
- mail:
|
|
|
|
- mail:
|
|
|
|
host: localhost
|
|
|
|
host: localhost
|
|
|
|
port: 25
|
|
|
|
port: 25
|
|
|
|
to: 'John Smith <john.smith@example.com>'
|
|
|
|
to: John Smith <john.smith@example.com>
|
|
|
|
subject: Ansible-report
|
|
|
|
subject: Ansible-report
|
|
|
|
body: 'System {{ ansible_hostname }} has been successfully provisioned.'
|
|
|
|
body: 'System {{ ansible_hostname }} has been successfully provisioned.'
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|