# confparser replacement for ini\_file module

**URL:** <https://forum.ansible.com/t/confparser-replacement-for-ini-file-module/19402>\
**Category:** Ansible Developer\
**Created:** [October 1, 2015, 12:38pm UTC](https://forum.ansible.com/t/confparser-replacement-for-ini-file-module/19402 "2015-10-01T12:38:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ritesh\_Khadgaray](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@Ritesh\_Khadgaray](https://forum.ansible.com/u/Ritesh_Khadgaray)\
**Post date:** [October 1, 2015, 12:38pm UTC](https://forum.ansible.com/t/confparser-replacement-for-ini-file-module/19402/1 "2015-10-01T12:38:47Z")

</div>

Hi,

I have written confparser module ( [https://github.com/ritzk/ansible-modules-extras-confparse](https://github.com/ritzk/ansible-modules-extras-confparse) ) as a replacement for ini\_file. Do let me know, if anyone finds this useful and what I need to add/remove .

Thanks

---

<div class="post-metadata">

**Author:** ![Chris11](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@Chris11](https://forum.ansible.com/u/Chris11)\
**Post date:** [October 1, 2015, 4:46pm UTC](https://forum.ansible.com/t/confparser-replacement-for-ini-file-module/19402/2 "2015-10-01T16:46:56Z")

</div>

I have had a PR in to fix the limitations of ini\_file for some time now. [https://github.com/ansible/ansible-modules-core/pull/1038](https://github.com/ansible/ansible-modules-core/pull/1038)  
The problem is apparently that no one has time to review it, and they haven’t taken me up on my offer to provide a test suite for it.

Chris

---

<div class="post-metadata">

**Author:** ![Ritesh\_Khadgaray](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@Ritesh\_Khadgaray](https://forum.ansible.com/u/Ritesh_Khadgaray)\
**Post date:** [October 4, 2015, 6:00am UTC](https://forum.ansible.com/t/confparser-replacement-for-ini-file-module/19402/3 "2015-10-04T06:00:59Z")

</div>

Hi

This still uses ConfigParser, which requires a section header. This can be worked out by inserting a dummy header - [https://stackoverflow.com/questions/2819696/parsing-properties-file-in-python/2819788#2819788](https://stackoverflow.com/questions/2819696/parsing-properties-file-in-python/2819788#2819788) .

My reasons for confparser

- It dumps the configurations out as a readable dictionary, which I use for executing different yml file

- It deals mostly with unix style configuration ( ifcfg/zabbix configs/…) which lack section header.

Cheers

-ritz
