0
votes

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."






1

1 Answers

1
votes

The error msg is clear:

parameters are mutually exclusive: api_key, username

Doc explains:

username for logging into the SendGrid account. Since 2.2 it is only required if api_key is not supplied.