community.general icon indicating copy to clipboard operation
community.general copied to clipboard

to_ini: add support for no_extra_spaces parameter

Open bluikko opened this issue 1 month ago • 2 comments

Summary

It would be nice if the to_ini filter supported the optional keyword parameter no_extra_spaces in the same way as ini_file module does:

  • Default to false to insert space characters before and after = in the resulting INI format output. This is the current behavior and also the default in ini_file module.
  • Set to true to not insert space characters before and after = in the resulting INI format output.

The reason for this is that both formats are widely used in different INI files. With this option the module can cater to use cases in both formats and not impose a certain formatting on the resulting output.
Then the resulting output can be chosen according to formatting possibly imposed by third parties and not create a situation where there are always changed=true task(s) that just remove/add spaces around the = in files written by to_ini.

ini_file module help for this same parameter: https://docs.ansible.com/ansible/latest/collections/community/general/ini_file_module.html#parameter-no_extra_spaces

Issue Type

Feature Idea

Component Name

to_ini

Additional Information


Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

bluikko avatar Jul 03 '24 08:07 bluikko