From 04b8c6ebbf1df9f2975f0c44c5609dae8fe4e7c2 Mon Sep 17 00:00:00 2001 From: Ahmed AbdelHalim Date: Thu, 11 Dec 2025 14:23:56 +0100 Subject: Update the testing to match real scenario (with passwordless test_group) The passwordless test_group is required to allow switching users without needing to add the password --- molecule/archlinux/Dockerfile.j2 | 4 ++++ molecule/archlinux/converge.yml | 1 + 2 files changed, 5 insertions(+) (limited to 'molecule/archlinux') diff --git a/molecule/archlinux/Dockerfile.j2 b/molecule/archlinux/Dockerfile.j2 index 3dc35f2d..b1e8c143 100644 --- a/molecule/archlinux/Dockerfile.j2 +++ b/molecule/archlinux/Dockerfile.j2 @@ -18,6 +18,10 @@ RUN (cd /lib/systemd/system/sysinit.target.wants/; \ # https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/59 RUN cp -r /usr/share/i18n/locales/en_US /usr/share/i18n/locales/de_DE; +# Enable passwordless sudo for test_group (created by the user role) +RUN echo '%test_group ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/test_group && \ + chmod 0440 /etc/sudoers.d/test_group + VOLUME ["/sys/fs/cgroup"] CMD ["/lib/systemd/systemd"] diff --git a/molecule/archlinux/converge.yml b/molecule/archlinux/converge.yml index 766ae51f..408bdd6d 100644 --- a/molecule/archlinux/converge.yml +++ b/molecule/archlinux/converge.yml @@ -20,6 +20,7 @@ - name: "Configure" hosts: "archlinux" gather_facts: true + remote_user: "{{ username }}" environment: PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" vars: -- cgit v1.2.3