All,
Ansible output of a playbook is csv file format. This needs to be converted to html table and send as mail body output within Ansible playbook.
Can someone share the task detail to convert csv file to html table.
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.
`
- 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=“admin@localhost.com”
to=“someone@email.com”
subtype=“html”
charset=utf8
delegate_to: 127.0.0.1
run_once: true
`
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="admin@localhost.com"
to="someone@email.com <Saravanan.Ponnusamy@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,
Here is my actual playbook. This gives me the output in plain csv file format. To represent the output via email, please suggest the right approach.