ANSIBLE.MAIL(3)

NAME
mail - Send an email

DESCRIPTION

This module is useful for sending emails from playbooks.

One may wonder why automate sending emails? In complex environments there are from time to time processes that cannot be automated, either because you lack the authority to make it so, or because not everyone agrees to a common approach.

If you cannot automate a specific step, but the step is non-blocking, sending out an email to the responsible party to make him perform his part of the bargain is an elegant way to put the responsibility in someone else's lap.

Of course sending out a mail can be equally useful as a way to notify one or more people in a team that a specific action has been (successfully) taken.

OPTIONS

attach
    A space-separated list of pathnames of files to attach to the message. Attached files will have their content-type set to application/octet-stream.(Added in Ansible version 1.0.)

bcc The email-address(es) the mail is being 'blind' copied to. This is a comma-separated list, which may contain address and phrase portions.

body
    The body of the email being sent. (default: $subject)

cc  The email-address(es) the mail is being copied to. This is a comma-separated list, which may contain address and phrase portions.

charset
    The character set of email being sent (default: us-ascii)

from
    The email-address the mail is sent from. May contain address and phrase. (default: root)

headers
    A vertical-bar-separated list of headers which should be added to the message. Each individual header is specified as header=value (see example below).(Added in Ansible version 1.0.)

host
    The mail server (default: localhost)

port
    The mail server port (default: 25)(Added in Ansible version 1.0.)

subject
    The subject of the email being sent.(required)

to  The email-address(es) the mail is being sent to. This is a comma-separated list, which may contain address and phrase portions. (default: root)."

EXAMPLES

Example playbook sending mail to root
local_action: mail msg='System ${ansible_hostname} has been sucessfully provisioned.'

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 <j.d@example.org>, Suzie Something <sue@example.com>"
      cc="Charlie Root <root@localhost>"
      attach="/etc/group /tmp/pavatar2.png"
      headers=Reply-To=john@example.com|X-Special="Something or other"
      charset=utf8
None

AUTHOR
Dag Wieers

SEE ALSO
ansible(1), http://ansible.github.com/modules.html#mail