The html content of your body contains quotes which break the quoting that
you wrap it in.

Instead of:

body="{{ lookup('file', './tmp/email.txt') }}"

Try:

body='{{ lookup("file", "./tmp/email.txt") }}'

Which is basically switching your surrounding quotes to ' since your body
uses " throughout.

On Thursday, March 5, 2015, Antoine Voiry <antoine.vo...@gmail.com> wrote:

> All,
> I am trying to send email in html
> I keep getting
> TASK: [pre_install | send email] *************************************
> fatal: [localhost -> 127.0.0.1] => A variable inserted a new parameter
> into the module args. Be sure to quote variables if they contain equal
> signs (for example: "{{var}}").
>
> My commands
>   - name: delete temp dir
>     local_action: file path=./tmp state=absent
>
>   - name: template create dir
>     local_action: file path=./tmp state=directory
>
>   - name: template email
>     local_action: template src=../files/email_template.j2
> dest=./tmp/email.txt
>
>
>   - name: send email
>     local_action: mail
>                 host='smtp3.hp.com'
>                 port=25
>                 subject="EGIT IIB ENVIRONMENT SETUP"
>                 body="{{ lookup('file', './tmp/email.txt') }}"
>                 from="antoine.vo...@gmail.com
> <javascript:_e(%7B%7D,'cvml','antoine.vo...@gmail.com');>"
>                 to="antoine.vo...@gmail.com
> <javascript:_e(%7B%7D,'cvml','antoine.vo...@gmail.com');>"
>                 cc="antoine.vo...@gmail.com
> <javascript:_e(%7B%7D,'cvml','antoine.vo...@gmail.com');>"
>                 headers="Content-type=text/html"
>
>
> The ./tmp/email.tx looks as follow
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.or
> g/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml";>
>     <head>
>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
> />
>         <title></title>
>         <style></style>
>     </head>
>     <body>
>         <table border="0" cellpadding="0" cellspacing="0" height="100%"
> width="1
> 00%" id="bodyTable">
>             <tr>
>                 <td align="center" valign="top">
>                     <table border="0" cellpadding="20" cellspacing="0"
> width="60
> 0" id="emailContainer">
>                         <tr>
>                             <td align="center" valign="top">
>                                 Dear All,<BR>
>                                 The environment SANDBOX will be built or
> re-buil
> t.
>                             </td>
>                         </tr>
>                         <tr>
>                             <td align="center" valign="top">
>                                 Kind Regards
>                                                             </td>
>                         </tr>
>
>                     </table>
>                 </td>
>             </tr>
>         </table>
>     </body>
> </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-project+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','ansible-project%2bunsubscr...@googlegroups.com');>
> .
> To post to this group, send email to ansible-project@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','ansible-project@googlegroups.com');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/74952b5a-f0b5-4a06-a2bf-57e35f6d243d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/74952b5a-f0b5-4a06-a2bf-57e35f6d243d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8ndH42w%2ByAR3g36TQ1AqQ3dBZsHcVnwCdNd8wdx-tQQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to