[PATCH 1/2] devconfig: drop locales-all leftovers

Daniel Gomez <[email protected]> Mon, 29 Sep 2025 21:04:12 +0200
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
From: Daniel Gomez <[email protected]>

When locales-all support was added in commit 2514a694 ("guestfs: fix
locale warnings in VM deployment"), it was added for all distros in the
virt-builder.j2 template as well as Ansible tasks to ensure idempotency
on previous base images.

But we just need to ensure en_US.UTF-8 is available on the guests
image, so keep just this config in both template and tasks but remove
locales-all.

While we are at it, also move the locale configuration after all deps
are installed and to the distro agnostic task section. We do it anyways
for all distros in virt-builder.j2, this ensures idempotency in all
of them.

Fixes: 6bb3bfb2 ("base_image: Skip "locales-all" package installation")
Signed-off-by: Daniel Gomez <[email protected]>
---
 playbooks/roles/devconfig/tasks/main.yml | 50 +++++++++++---------------------
 1 file changed, 17 insertions(+), 33 deletions(-)

diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
index ae16a698..1acca6b4 100644
--- a/playbooks/roles/devconfig/tasks/main.yml
+++ b/playbooks/roles/devconfig/tasks/main.yml
@@ -54,17 +54,25 @@
     dest: /etc/hostname
   tags: hostname
 
-- name: Ensure locales-all package is installed
-  become: true
-  become_flags: "su - -c"
-  become_method: sudo
-  ansible.builtin.package:
-    name: locales-all
-    state: present
+# Distro specific
+
+# Check and fix APT mirrors for Debian testing before installing dependencies
+- name: Check and fix APT mirrors for Debian testing
+  ansible.builtin.include_tasks: check-apt-mirrors.yml
   when:
-    - ansible_facts['os_family']|lower == 'debian'
-  tags: firstconfig
+    - devconfig_debian_testing is defined
+    - devconfig_debian_testing | bool
+
+- name: Install dependencies
+  ansible.builtin.include_tasks: install-deps/main.yml
+  tags: ["vars", "vars_simple"]
 
+- name: Configure custom repositories and install packages
+  ansible.builtin.import_tasks: config-custom-repos-and-packages/main.yml
+  when:
+    - ansible_facts['os_family']|lower == 'redhat'
+
+# Distro agnostic stuff goes below
 - name: Configure en_US.UTF-8 locale files
   become: true
   become_flags: "su - -c"
@@ -80,8 +88,6 @@
     - { path: "/etc/default/locale", line: "LANG=en_US.UTF-8" }
     - { path: "/etc/default/locale", line: "LANGUAGE=en_US:en" }
     - { path: "/etc/locale.gen", line: "en_US.UTF-8 UTF-8" }
-  when:
-    - ansible_facts['os_family']|lower == 'debian'
   tags: firstconfig
 
 - name: Generate and update locales
@@ -92,30 +98,8 @@
     locale-gen en_US.UTF-8
     update-locale LANG=en_US.UTF-8
   changed_when: true
-  when:
-    - ansible_facts['os_family']|lower == 'debian'
   tags: firstconfig
 
-# Distro specific
-
-# Check and fix APT mirrors for Debian testing before installing dependencies
-- name: Check and fix APT mirrors for Debian testing
-  ansible.builtin.include_tasks: check-apt-mirrors.yml
-  when:
-    - devconfig_debian_testing is defined
-    - devconfig_debian_testing | bool
-
-- name: Install dependencies
-  ansible.builtin.include_tasks: install-deps/main.yml
-  tags: ["vars", "vars_simple"]
-
-- name: Configure custom repositories and install packages
-  ansible.builtin.import_tasks: config-custom-repos-and-packages/main.yml
-  when:
-    - ansible_facts['os_family']|lower == 'redhat'
-
-# Distro agnostic stuff goes below
-
 - name: Check if /mirror directory exists on localhost
   delegate_to: localhost
   ansible.builtin.stat:

-- 
2.50.1