On Monday, 27 August 2018 13.40.48 CEST Saravanan wrote:
> All,
> In the below Ansible email task, instead of attaching the csv file to the
> email, need to send the contend of csv file in the body of the email as
> html table.
I'm not sure what you are trying too achieve but you should probably check at ARA
https://github.com/openstack/ara
>
> - name: Send the SSH status to email
> local_action: mail
> host= '127.0.0.1'
> port=25
> subject="SSH Connection status for Unix sudo accounts"
> body="SSH Failure Service accounts"
> attach="/tmp/content.csv"
> from="
ad...@localhost.com"
> to="
som...@email.com <
Saravanan...@email.com>"
> subtype="html"
> charset=utf8
> delegate_to: 127.0.0.1
> run_once: true
What you are trying to do is possible but you need to go through a lot of hoops, choosing csv is making this harder that is could be, yaml or json would have been easier.
As is, you would need to create the csv file to a list of list, then use template to create the html table.
--
Kai Stian Olstad