ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
821 stars 1.51k forks source link

locale_gen allow configuring multiple locales #8677

Closed MatthiasKunnen closed 2 months ago

MatthiasKunnen commented 2 months ago

Summary

The locale_gen module currently allows for a single locale to be configured at a time. Using a loop here isn't the most efficient because both the detection of the current state and the generation of the locale after change needs to be run for every locale. If there are no objections, I would like to add the ability to configure multiple at the same time.

Regarding implementation, to avoid breaking changes, I would add a names parameter and keep the existing one. Is the best practice for Ansible?

Issue Type

Feature Idea

Component Name

locale_gen

Additional Information

- name: Set and generate locale
  community.general.locale_gen:
    names:
      - de_CH.UTF-8
      - en_US.UTF-8
    state: present

Code of Conduct

ansibullbot commented 2 months ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 2 months ago

cc @AugustusKling click here for bot help

felixfontein commented 2 months ago

Regarding implementation, to avoid breaking changes, I would add a names parameter and keep the existing one. Is the best practice for Ansible?

You can also change the type of the current name parameter to list (elements: str). Since locale names cannot contain commas this will be backwards compatible: Ansible converts strings to lists by splitting by comma.

(If locale names could contain commas this would not be OK, in that case adding a new list option names and making name and names mutually exclusive would be best.)