New in version 2.0.
The below requirements are needed on the host that executes this module.
Parameter | Choices/Defaults | Comments |
---|---|---|
api_key (added in 2.2) | sendgrid API key to use instead of username/password | |
attachments (added in 2.2) | a list of relative or explicit paths of files you want to attach (7MB limit as per SendGrid docs) | |
bcc (added in 2.2) | a list of email addresses to bcc | |
cc (added in 2.2) | a list of email addresses to cc | |
from_address required | the address in the "from" field for the email | |
from_name (added in 2.2) | the name you want to appear in the from field, i.e 'John Doe' | |
headers (added in 2.2) | a dict to pass on as headers | |
html_body bool (added in 2.2) |
| whether the body is html content that should be rendered |
password | password that corresponds to the username Since 2.2 it is only required if api_key is not supplied. | |
subject required | the desired subject for the email | |
to_addresses required | a list with one or more recipient email addresses | |
username | username for logging into the SendGrid account. Since 2.2 it is only required if api_key is not supplied. |
Note
# send an email to a single recipient that the deployment was successful - sendgrid: username: "{{ sendgrid_username }}" password: "{{ sendgrid_password }}" from_address: "[email protected]" to_addresses: - "[email protected]" subject: "Deployment success." body: "The most recent Ansible deployment was successful." delegate_to: localhost # send an email to more than one recipient that the build failed - sendgrid: username: "{{ sendgrid_username }}" password: "{{ sendgrid_password }}" from_address: "[email protected]" to_addresses: - "[email protected]" - "[email protected]" subject: "Build failure!." body: "Unable to pull source repository from Git server." delegate_to: localhost
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.
For a list of other modules that are also maintained by the Ansible Community, see here.
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/sendgrid_module.html