community / community.general / 0.2.1 / module / sendgrid Sends an email with the SendGrid API Authors: Matt Makai (@makaimc)community.general.sendgrid (0.2.1) — module
Install with ansible-galaxy collection install community.general:==0.2.1
collections: - name: community.general version: 0.2.1
Sends an email with a SendGrid account through their API, not through the SMTP service.
- name: Send an email to a single recipient that the deployment was successful sendgrid: username: "{{ sendgrid_username }}" password: "{{ sendgrid_password }}" from_address: "ansible@mycompany.com" to_addresses: - "ops@mycompany.com" 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 sendgrid: username: "{{ sendgrid_username }}" password: "{{ sendgrid_password }}" from_address: "build@mycompany.com" to_addresses: - "ops@mycompany.com" - "devteam@mycompany.com" subject: "Build failure!." body: "Unable to pull source repository from Git server." delegate_to: localhost
cc: description: - a list of email addresses to cc bcc: description: - a list of email addresses to bcc api_key: description: - sendgrid API key to use instead of username/password headers: description: - a dict to pass on as headers subject: description: - the desired subject for the email required: true password: description: - password that corresponds to the username - Since 2.2 it is only required if api_key is not supplied. username: description: - username for logging into the SendGrid account. - Since 2.2 it is only required if api_key is not supplied. from_name: description: - the name you want to appear in the from field, i.e 'John Doe' html_body: default: 'no' description: - whether the body is html content that should be rendered type: bool attachments: description: - a list of relative or explicit paths of files you want to attach (7MB limit as per SendGrid docs) from_address: description: - the address in the "from" field for the email required: true to_addresses: description: - a list with one or more recipient email addresses required: true