Hi All,
How to display the file contents in the body of the mail module.
mail:
body: /tmp/file2.txt
Hi All,
How to display the file contents in the body of the mail module.
mail:
body: /tmp/file2.txt
cat /tmp/file2.txt
I have used the below playbook and the lookup option getting failed
- name:send mail
mail:
subtype: html
I have used the below playbook and the lookup option getting failed
- name:send mail
mail:
subtype: html
to: xxx.gmail.com
from: yyy.gmail.com
subject: test email
body: "{{lookup('file', '/tmp/{{today}}.html')}}"
(This line ^^ is distinctly different from your initial message BTW)
In any case, you can't use nested jinja delimiters ({{}}).
Try this:
body: "{{ lookup('file', '/tmp/' ~ today ~ '.html') }}"
Getting the same error.
The file is present in the target machine. whether lookup will not work there.
Lookups are always done on the controller. You could retrieve the file from the
target machine with the "fetch" module.
Regards
Racke