# Module to patch (update) environment variables file with version

**URL:** <https://forum.ansible.com/t/module-to-patch-update-environment-variables-file-with-version/5254>\
**Category:** Get Help\
**Tags:** playbook, ansible-core\
**Created:** [May 2, 2024, 9:59am UTC](https://forum.ansible.com/t/module-to-patch-update-environment-variables-file-with-version/5254 "2024-05-02T09:59:18Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [May 2, 2024, 1:07pm UTC](https://forum.ansible.com/t/module-to-patch-update-environment-variables-file-with-version/5254/4 "2024-05-02T13:07:09Z")

</div>

There are several great ways to read, write and modify INI files using Ansible, I [linked to them in this comment](http://forum.ansible.com/t/call-to-action-send-us-your-see-also-suggestions/4093/2#ini-conf-1), `.ini` / `.conf` / `.env` file lookup, fliters and modules:

- [community.general.ini\_file module](https://docs.ansible.com/ansible/latest/collections/community/general/ini_file_module.html)
- [ansible.builtin.ini lookup](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/ini_lookup.html)
- [community.general.to\_ini filter](https://docs.ansible.com/ansible/latest/collections/community/general/to_ini_filter.html)
- [community.general.from\_ini filter](https://docs.ansible.com/ansible/latest/collections/community/general/from_ini_filter.html)

JC INI parsers that can be used with [the JC filter](https://docs.ansible.com/ansible/latest/collections/community/general/jc_filter.html):

- [jc.parsers.ini](https://kellyjonbrazil.github.io/jc/docs/parsers/ini)
- [jc.parsers.ini\_dup](https://kellyjonbrazil.github.io/jc/docs/parsers/ini_dup)

I’d suggest using these rather than `lineinfile`.

---

_[View the full topic](https://forum.ansible.com/t/module-to-patch-update-environment-variables-file-with-version/5254)._
