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

**URL:** <https://forum.ansible.com/t/accessing-values-from-cfg-ini-file-and-using-that-in-playbook/34053>\
**Category:** Ansible Developer\
**Created:** [October 19, 2020, 12:56pm UTC](https://forum.ansible.com/t/accessing-values-from-cfg-ini-file-and-using-that-in-playbook/34053 "2020-10-19T12:56:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Akshay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Akshay\_Kumar](https://forum.ansible.com/u/Akshay_Kumar)\
**Post date:** [October 19, 2020, 12:56pm UTC](https://forum.ansible.com/t/accessing-values-from-cfg-ini-file-and-using-that-in-playbook/34053/1 "2020-10-19T12:56:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kelly\_Brazil](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@Kelly\_Brazil](https://forum.ansible.com/u/Kelly_Brazil)\
**Post date:** [October 19, 2020, 2:21pm UTC](https://forum.ansible.com/t/accessing-values-from-cfg-ini-file-and-using-that-in-playbook/34053/2 "2020-10-19T14:21:33Z")

</div>

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/](https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/)

Kelly
