Note
This plugin is part of the community.general collection.
To install it use: ansible-galaxy collection install community.general.
To use it in a playbook, specify: community.general.sendgrid.
The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
| api_key string | sendgrid API key to use instead of username/password | |
| attachments string | a list of relative or explicit paths of files you want to attach (7MB limit as per SendGrid docs) | |
| bcc string | a list of email addresses to bcc | |
| cc string | a list of email addresses to cc | |
| from_address string / required | the address in the "from" field for the email | |
| from_name string | the name you want to appear in the from field, i.e 'John Doe' | |
| headers string | a dict to pass on as headers | |
| html_body boolean |
| whether the body is html content that should be rendered |
| password string | password that corresponds to the username Since 2.2 it is only required if api_key is not supplied. | |
| subject string / required | the desired subject for the email | |
| to_addresses string / required | a list with one or more recipient email addresses | |
| username string | username for logging into the SendGrid account. Since 2.2 it is only required if api_key is not supplied. |
Note
- name: Send an email to a single recipient that the deployment was successful
community.general.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
- name: Send an email to more than one recipient that the build failed
community.general.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
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/general/sendgrid_module.html