mail module

35 views
Skip to first unread message

Prajwal Gowda

unread,
Sep 18, 2020, 1:53:29 AM9/18/20
to ansible...@googlegroups.com
hi team i need one help with the mail module
it is throwing error address family not supported
if anyone know how to send mail when the task failed please help 

thanks
prajwal h g

Dick Visser

unread,
Sep 18, 2020, 1:55:12 AM9/18/20
to ansible...@googlegroups.com

Post your playbook

--


You received this message because you are subscribed to the Google Groups "Ansible Project" group.


To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.


To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAMQ8AOioANh_WaQ9j5ux3DJVNDNmCkJ2f%2BxRCzhzF9Xwoqkd3A%40mail.gmail.com.


--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

P&R Music&video's

unread,
Sep 19, 2020, 5:02:21 AM9/19/20
to ansible...@googlegroups.com
here is my playbook
---
     - hosts:all 
       tasks:    
          -   name: send mail
              mail:
                    host: "smtp.gmail.com"
                    port: 587
                    sender: "x...@gmail.com"
                    to: "Prajwal H G <x...@cc.com>"
                    subject: "Report for { { ansible_hostname } }"
                    body: "Server { { ansible_hostname } } has bene updated"
             delegate_to: localhost

P&R Music&video's

unread,
Sep 20, 2020, 12:40:55 AM9/20/20
to ansible...@googlegroups.com
hi team can you please suggest a solution if anyone knows whats happening here

Dick Visser

unread,
Sep 20, 2020, 2:25:23 AM9/20/20
to ansible...@googlegroups.com
On Sat, 19 Sep 2020 at 11:02, P&R Music&video's
<prajwal...@gmail.com> wrote:
>
> here is my playbook
> ---
> - hosts:all
> tasks:
> - name: send mail
> mail:
> host: "smtp.gmail.com"
> port: 587
> sender: "x...@gmail.com"

There is no 'sender' argument. See
https://docs.ansible.com/ansible/latest/modules/mail_module.html


Other than that it looks OK.
So, what is the EXACT error output you get when running the task>?
Also what version etc etc.

And keep in mind Gmail requires an application specific password:
https://support.google.com/mail/answer/185833?hl=en

Dick Visser

unread,
Sep 20, 2020, 2:33:45 AM9/20/20
to ansible...@googlegroups.com
On Sun, 20 Sep 2020 at 08:24, Dick Visser <dick....@geant.org> wrote:

> > sender: "x...@gmail.com"
>
> There is no 'sender' argument. See
> https://docs.ansible.com/ansible/latest/modules/mail_module.html

Actually 'sender' is an undocumted alias for 'from', so this will work.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

P&R Music&video's

unread,
Sep 20, 2020, 9:51:02 AM9/20/20
to ansible...@googlegroups.com
I attached my ansible version screen shot and error screenshot please look at this and help me out as soon as possible I stuck up with this problem for a week 

Thanks
Prajwal h g

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
IMG_20200920_190453.jpg
IMG_20200920_190304.jpg

Dick Visser

unread,
Sep 20, 2020, 10:34:05 AM9/20/20
to ansible...@googlegroups.com
On Sun, 20 Sep 2020 at 15:50, P&R Music&video's
<prajwal...@gmail.com> wrote:
>
> I attached my ansible version screen shot and error screenshot please look at this and help me out as soon as possible I stuck up with this problem for a week

Sounds like bad planning on your side.
You might get more help if you provide better information to start
with, and change your attitude.
This list is run by volunteers, so don't order them around.

The issue is with your controller node, it appears to have some
screwed up network configuration.
Check manually if you can set up connections to the specific
host/port, for instance with OpenSSL s_client:

echo "EHLO blah.com" | openssl s_client -starttls smtp -crlf -connect
smtp.gmail.com:587

This should give you a 250 response code. If it doesn't work, then you
need to fix that. If it's fixed, then your ansible playbook should
also work.

PS next time just post actual text if asked, and not some shaky 3MB photo...

Dick


>
> Thanks
> Prajwal h g
>
> On Sun, 20 Sep, 2020, 12:03 PM Dick Visser, <dick....@geant.org> wrote:
>>
>> On Sun, 20 Sep 2020 at 08:24, Dick Visser <dick....@geant.org> wrote:
>>
>> > > sender: "x...@gmail.com"
>> >
>> > There is no 'sender' argument. See
>> > https://docs.ansible.com/ansible/latest/modules/mail_module.html
>>
>> Actually 'sender' is an undocumted alias for 'from', so this will work.
>>
>>
>>
>> --
>> Dick Visser
>> Trust & Identity Service Operations Manager
>> GÉANT
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwNg5Dm942_VhoMPu0S_D8qDnDDJ10D1qHUxrmrSs%3DbFnA%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAMQ8AOgGaQ-F%3DQ645dAUdA1P-uram0yGQ-PngnoFSzRT8Z1VOQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages