Using Ansible to create, edit and read INI files

The latest version of community.general is 8.2.0 but the documentation at docs.ansible.com is still at 8.1.0 — I was looking for the documentation for the new from_ini and to_ini filters, I’ve tried Ansible Galaxy but the from_ini docs and to_ini docs pages have no content.

The reason I’m asking is because I have been using the JC filter with the ini parser and ini_dup parser 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 one — that covers the two new filters as well as the community.general.ini_file module 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.

1 Like

Hello @chris

The latest version of Ansible community Package (now 9.1.0) includes 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?

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

3 Likes

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

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.

5 Likes

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 :wink: )

4 Likes

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, so I’ll continue using the jc filters for now, ini and ini_dup.