Ansible problem with command shell : mail

13 views
Skip to first unread message

Karther

unread,
Dec 30, 2019, 5:36:33 AM12/30/19
to Ansible Project
Hey !!

With prompt shell on my linux this command works perfectly :

mail -a "Content-Type: text/html" -s "Ansible deployment HospitalisV3" m...@outlook.com </home/ansible/test_hospi_package/frontoffice/roles/frontoffice/files/mail_content.html

But when i use this next task, there is error with ansible :

- name: "Execut command shell with html"
  shell: mail -a "Content-Type: text/html" -s "Ansible deployment HospitalisV3" m...@outlook.com </home/ansible/test_hospi_package/frontoffice/roles/frontoffice/files/mail_content.html
  delegate_to: localhost

Error is that ansible not understand "Content-Type: text/html"

Someone can you help me please community Ansible !!! :)

Best Regards,

Karther

Dick Visser

unread,
Dec 30, 2019, 5:50:35 AM12/30/19
to ansible...@googlegroups.com
Try using the native mail module instead of shell:
https://docs.ansible.com/ansible/latest/modules/mail_module.html
> --
> 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/7ba52f7d-52ae-4d23-979a-c071112157f8%40googlegroups.com.



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

Karther

unread,
Dec 30, 2019, 8:11:38 AM12/30/19
to Ansible Project
Thanks for your help Dick !! :)

But i try this module mail and the module in documentation Ansible but it's not works :
The error is :

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: socket.error: [Errno 101] Network is unreachable

It's for that i use commande mail and not module of ansible ...

Thanks for your help community ansible !! ^_^

Regards,

Karther

Le lundi 30 décembre 2019 11:50:35 UTC+1, Dick Visser a écrit :
Try using the native mail module instead of shell:
https://docs.ansible.com/ansible/latest/modules/mail_module.html

On Mon, 30 Dec 2019 at 11:36, Karther <ryadmo...@gmail.com> wrote:
>
> Hey !!
>
> With prompt shell on my linux this command works perfectly :
>
> mail -a "Content-Type: text/html" -s "Ansible deployment HospitalisV3" m...@outlook.com </home/ansible/test_hospi_package/frontoffice/roles/frontoffice/files/mail_content.html
>
> But when i use this next task, there is error with ansible :
>
> - name: "Execut command shell with html"
>   shell: mail -a "Content-Type: text/html" -s "Ansible deployment HospitalisV3" m...@outlook.com </home/ansible/test_hospi_package/frontoffice/roles/frontoffice/files/mail_content.html
>   delegate_to: localhost
>
> Error is that ansible not understand "Content-Type: text/html"
>
> Someone can you help me please community Ansible !!! :)
>
> Best Regards,
>
> Karther
>
> --
> 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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages