# Using Ansible to create, edit and read INI files

**URL:** <https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155>\
**Category:** Get Help\
**Tags:** documentation, collections, galaxy-ng\
**Created:** [January 4, 2024, 10:08am UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155 "2024-01-04T10:08:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 4, 2024, 10:08am UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155/1 "2024-01-04T10:08:45Z")

</div>

The latest version of [community.general is 8.2.0](https://github.com/ansible-collections/community.general/releases/tag/8.2.0) but the [documentation at `docs.ansible.com`](https://docs.ansible.com/ansible/latest/collections/community/general/) is still at `8.1.0` — I was looking for the documentation for the [new `from_ini` and `to_ini` filters](https://github.com/ansible-collections/community.general/blob/stable-8/CHANGELOG.rst#filter), I’ve tried [Ansible Galaxy](https://galaxy.ansible.com/ui/repo/published/community/general/) but the [`from_ini` docs](https://galaxy.ansible.com/ui/repo/published/community/general/content/filter/from_ini/) and [`to_ini` docs](https://galaxy.ansible.com/ui/repo/published/community/general/content/filter/to_ini/) pages have no content.

The reason I’m asking is because I have been using the [JC filter](https://docs.ansible.com/ansible/latest/collections/community/general/jc_filter.html#ansible-collections-community-general-jc-filter) with the [`ini` parser](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) and [`ini_dup` parser](https://kellyjonbrazil.github.io/jc/docs/parsers/ini_dup) and I’m wondering if I should consider switching to use these new filters?

I was also wondering if a documentation page on working with INI files, a bit like the [Selecting JSON data: JSON queries](https://docs.ansible.com/ansible/latest/collections/community/general/docsite/filter_guide_selecting_json_data.html) one — that covers the two new filters as well as the [community.general.ini\_file module](https://docs.ansible.com/ansible/latest/collections/community/general/ini_file_module.html) might be something that would help users — I’m sure most people here know that many key Free / Open Source software projects use INI files for their configuration including PHP, MariaDB / MySQL and Systemd.

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [January 4, 2024, 10:53am UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155/2 "2024-01-04T10:53:30Z")

</div>

Hello @chris

The latest version of Ansible community Package (now 9.1.0) [includes](https://github.com/ansible-community/ansible-build-data/blob/main/9/CHANGELOG-v9.rst#changed-collections) `community.general` collection 8.1.0.  
So now Ansible document shows `community.general` collection 8.1.0 information.

And, Ansible Galaxy doesn’t seem to be able to display the documentation for the filter plugin.

As a work-around, why not refer to the documentation poart in the code?

- [from\_ini filter](https://github.com/ansible-collections/community.general/blob/8.2.0/plugins/filter/from_ini.py)
- [to\_ini filter](https://github.com/ansible-collections/community.general/blob/8.2.0/plugins/filter/to_ini.py)

May be if Ansible Community Package 9.2.0 is released, document will show `community general` 8.2.0.

---

<div class="post-metadata">

**Author:** ![samccann](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/samccann/32/18_2.png) [@samccann](https://forum.ansible.com/u/samccann)\
**Post date:** [January 4, 2024, 3:30pm UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155/3 "2024-01-04T15:30:25Z")

</div>

While we don’t recommend this for every-day use… if new collection version comes out, it usually shows up on the ‘devel’ version of the docs first:  
[https://docs.ansible.com/ansible/devel/collections/community/general/index.html](https://docs.ansible.com/ansible/devel/collections/community/general/index.html)

As @akira6592 said, this is because Ansible 9 won’t include this collection version until the next release.

I’m unsure why Galaxy doesn’t seem to display any of the filter docs in this collection. I’ll open a new topic with the galaxy folks to see why thats happening.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 4, 2024, 8:58pm UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155/4 "2024-01-04T20:58:04Z")

</div>

> [@akira6592](#):
>
> May be if Ansible Community Package 9.2.0 is released, document will show `community general` 8.2.0.

It won’t show 8.2.0 since by then community.general 8.3.0 is out, and that will be the community.general version contained in ansible 9.2.0. (Sorry for nit-picking 😉 )

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [January 24, 2024, 9:49am UTC](https://forum.ansible.com/t/using-ansible-to-create-edit-and-read-ini-files/3155/5 "2024-01-24T09:49:40Z")

</div>

I’ve finally got around to playing with the new `from_ini` filter and have found that it [doesn’t support INI files without section headers](https://github.com/ansible-collections/community.general/issues/7889), so I’ll continue using the [jc](https://docs.ansible.com/ansible/latest/collections/community/general/jc_filter.html) filters for now, [ini](https://kellyjonbrazil.github.io/jc/docs/parsers/ini) and [ini\_dup](https://kellyjonbrazil.github.io/jc/docs/parsers/ini_dup).
