I’m currently writing an Ansible playbook for Rocky Linux 8 and 9.
At some point I have to define my locale using something like this:
localectl set-locale LANG=fr_FR.UTF-8
Curiously enough, there’s no Ansible module to handle localectl.
Now I could simply use the command module with changed_when: false. But I wonder: when defining the locale using localectl, what exactly is altered under the hood? I was hoping to use creates: something to make this idempotent.
man localectl
localectl may be used to query and change the system locale and keyboard layout settings. It communicates with systemd-localed(8) to modify files
such as /etc/locale.conf and /etc/vconsole.conf.
The man page lists /etc/locale.conf and /etc/vconsole.conf as files that it potentially changes.
$ cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
...
I don’t know whether that is only for X11 or also for Wayland.