From b13f89a2507318af591e0a2fd0a0930fa890975d Mon Sep 17 00:00:00 2001 From: Sandwich Date: Sun, 22 Feb 2026 14:20:12 +0100 Subject: [PATCH] fix(global_defaults): apply mirror default in pre-computed system_cfg path --- roles/global_defaults/tasks/system.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/roles/global_defaults/tasks/system.yml b/roles/global_defaults/tasks/system.yml index 2eb5855..30891a8 100644 --- a/roles/global_defaults/tasks/system.yml +++ b/roles/global_defaults/tasks/system.yml @@ -29,6 +29,25 @@ ansible.builtin.set_fact: system_cfg: "{{ system_defaults | combine(system | default({}), recursive=True) | combine(system_cfg, recursive=True) }}" +- name: Apply mirror default for pre-computed system_cfg + when: + - system_cfg is defined + - _bootstrap_needs_enrichment | default(false) | bool + - system_cfg.mirror | default('') | string | trim | length == 0 + vars: + # Same as _normalize_system.yml — kept in sync manually. + _mirror_defaults: + debian: "https://deb.debian.org/debian/" + ubuntu: "http://mirror.ubuntu.com/ubuntu/" + ubuntu-lts: "http://mirror.ubuntu.com/ubuntu/" + ansible.builtin.set_fact: + system_cfg: >- + {{ + system_cfg | combine({ + 'mirror': _mirror_defaults[system_cfg.os | default('') | string | lower] | default('') + }, recursive=True) + }} + - name: Derive convenience facts from pre-computed system_cfg when: - system_cfg is defined