# Gather info about various files from different servers and generate a CSV file

**URL:** <https://forum.ansible.com/t/gather-info-about-various-files-from-different-servers-and-generate-a-csv-file/27700>\
**Category:** Ansible Project\
**Created:** [June 4, 2018, 11:50am UTC](https://forum.ansible.com/t/gather-info-about-various-files-from-different-servers-and-generate-a-csv-file/27700 "2018-06-04T11:50:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saranya\_N](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Saranya\_N](https://forum.ansible.com/u/Saranya_N)\
**Post date:** [June 4, 2018, 11:50am UTC](https://forum.ansible.com/t/gather-info-about-various-files-from-different-servers-and-generate-a-csv-file/27700/1 "2018-06-04T11:50:00Z")

</div>

Gather info about files in various hosts and generate csv file.

Im trying to capture all xml files in a set hosts that have the string “cc:”. Also I want to know the usage of this pattern in the xml files , so I try to grep them using shell module. My ultimate goal is to get a csv file with

HOSTNAME,FILE, GREP\_OUTPUTLINES

For ex Host A might have two files dev.xml , perf.xml that has “cc:” usages in many lines:

Dev.xml

"\<dependency location=\"cc://view/jrobin-1.5.9.1.jar\" name=\"robMon\" target\_dir=\"${root}/vendor/\"/ /\>”

“\<directive oscmd="ln -s ${root}/logs/ ${root}/httpd/servers/fluswaasd1-ahs1/htdocs" phase="post-install" dir=”cc:/view/text/def.txt” /\>”

Perf.xml

“\<artifact location="cc://view/cli\_metafile.1.3.0.xsd" target\_dir="${root}/stage/" /\>”

\<dependency location="cc://view/javamelody-1.39.0.jar" name="melMon" target\_dir="${root}/vendor/"/\>

Since these grep o/p gets captured in the results.stdout . I tried to write a jija2 template to loop over this and write them to a csv file. But it doesn’t seem to work.

Any ideas or suggestions on how I can achieve this??

Kindly help
