Through the ansible documentation page, I see ansible supporting sending email via sendgrid. I have tried following the code example but I still failed to send and exit the following message.
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
PLAY [localhost] *********************************************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************************************** ok: [localhost]
TASK [sendgrid] ********************************************************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "msg": "parameters are mutually exclusive: api_key, username"} to retry, use: --limit @/home/valutac/opreker/mail-test.retry
PLAY RECAP *************************************************************************************************************************************************************************************** localhost : ok=1 changed=0 unreachable=0 failed=1
Here I also display the contents of the playbook
---
- hosts: localhost
tasks:
- sendgrid:
username: "mail"
password: "xxx"
api_key: "SG.1414rfdsvefvwev.dsadasvef34r2-3e1qdqecweqc"
from_address: "[email protected]"
to_addresses:
- "[email protected]"
subject: "Deployment success."
body: "The most recent Ansible deployment was successful."