From a2a191770cc68371228bfba036ef8363fc11ee3c 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/debian/Dockerfile.j2 | 4 ++++ molecule/debian/converge.yml | 1 + 2 files changed, 5 insertions(+) (limited to 'molecule/debian') diff --git a/molecule/debian/Dockerfile.j2 b/molecule/debian/Dockerfile.j2 index 2e047439..3a5642a9 100644 --- a/molecule/debian/Dockerfile.j2 +++ b/molecule/debian/Dockerfile.j2 @@ -20,6 +20,10 @@ RUN rm -f /lib/systemd/system/multi-user.target.wants/getty.target RUN systemctl enable avahi-daemon \ && touch /etc/locale.gen +# 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", "/tmp", "/run", "/opt"] CMD ["/lib/systemd/systemd"] diff --git a/molecule/debian/converge.yml b/molecule/debian/converge.yml index 7d06f734..7fcfbce6 100644 --- a/molecule/debian/converge.yml +++ b/molecule/debian/converge.yml @@ -20,6 +20,7 @@ - name: "Configure" hosts: "debian" gather_facts: true + remote_user: "{{ username }}" environment: PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" vars: -- cgit v1.2.3