From 78eb5ef3cc4099f5f0ddcc1b8f0bbb5d9b82ef32 Mon Sep 17 00:00:00 2001 From: Julien D <150942337+jdaln@users.noreply.github.com> Date: Tue, 7 Jul 2026 20:13:27 +0200 Subject: [PATCH] fix: Improve loop display and refresh apt cache --- roles/users_add/tasks/main.yml | 12 ++++++++++++ setup-playbook.yml | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/roles/users_add/tasks/main.yml b/roles/users_add/tasks/main.yml index 937b50b..9157f02 100644 --- a/roles/users_add/tasks/main.yml +++ b/roles/users_add/tasks/main.yml @@ -3,6 +3,8 @@ name: "{{ item.username }}" state: present loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) - name: Create user accounts and force password change on first login ansible.builtin.user: @@ -26,6 +28,8 @@ state: present comment: "{{ item.username }} key" loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) - name: Add all users who should be admin to sudo ansible.builtin.lineinfile: @@ -36,6 +40,8 @@ create: true validate: '/usr/sbin/visudo -cf %s' loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) when: item.admin - name: Allow non-admin users to run system updates/upgrades @@ -64,6 +70,8 @@ mode: '0440' validate: '/usr/sbin/visudo -cf %s' loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) when: - not item.admin - item.non_admin_allowed_commands is defined @@ -92,6 +100,8 @@ owner: root group: root loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) when: - not item.admin - item.non_admin_allowed_commands is defined @@ -352,6 +362,8 @@ groups: no2fa append: true loop: "{{ users_add_userlist | default([]) }}" + loop_control: + label: "{{ item.username }}" # avoid printing the full record (contains initialpassword) when: - enable_2fa | default(false) - item.enable_2fa is defined diff --git a/setup-playbook.yml b/setup-playbook.yml index cc35523..bf71fd5 100644 --- a/setup-playbook.yml +++ b/setup-playbook.yml @@ -111,6 +111,14 @@ label: "{{ item.path }}" when: apt_mirror_sources.matched | int > 0 + - name: Refresh apt cache with the corrected sources + ansible.builtin.apt: + update_cache: true + register: apt_cache_refresh + retries: 3 + delay: 5 + until: apt_cache_refresh is succeeded + tasks: # =================================================================== # USER MANAGEMENT SECTION