I have a code as below and i have my html files present in /tmp/sanity/ .
but i am getting error as "Failed to send mail: can't attach file" i get
file not found
- name: list html files
run_once: true
local_action: shell find /tmp/sanity/ -type f -regex ".*.html" | tr -s
'\n' ' ' | xargs | sort
register: list_html_files
- debug: msg="{{ list_html_files }}"
- name: generate final email body
run_once: true
local_action: shell for i in `find /tmp/sanity/ -type f -regex
".*email.*.txt" | sort`; do cat $i ;done
register: email_body
- debug: msg="{{email_body}}"
- name: email results
become: true
ignore_errors: true
run_once: true
mail:
host: "{{smtp_host}}"
port: 25
subject: "raka"
body: '{{ email_body.stdout }}'
from: xxxxxxx
to: "{{ email | default('xxxxxx') }}"
attach:
- '{{ list_html_files.stdout_lines[0] }}'
charset: utf8
delegate_to: localhost
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/69c639e2-ce8f-4931-90f4-bdb3ee0c00b5%40googlegroups.com.