Accessing values from cfg/ini file and using that in playbook

Hi Team,

I am trying to do the following , would appreciate if someone has a better idea to workout for the scenario:

Cfg file-----

Section1:
ls:
first:
DirName: /home/kumar/DevFileLocation
User: kumar

Section2:

rm:
first:
DirName: /home/kumar/DevFileLocation
User: kumar

for this cfg i want to write playbook which will pick up data form cfg file and run list command in the playbook task.

Thanks

Hi Akshay,

The jc filter in the community.general collection can turn INI and YAML files into objects you can use in your playbooks.

https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/

Kelly