diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-12-11 14:23:56 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-12-11 14:25:39 +0100 |
| commit | a2a191770cc68371228bfba036ef8363fc11ee3c (patch) | |
| tree | bb2df2300cb28af028dfe5ebac9c05ae842a0643 /molecule | |
| parent | a4c0d3820db7b638c9f25c208414c29b9f9475e0 (diff) | |
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
Diffstat (limited to 'molecule')
| -rw-r--r-- | molecule/archlinux/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | molecule/archlinux/converge.yml | 1 | ||||
| -rw-r--r-- | molecule/debian/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | molecule/debian/converge.yml | 1 | ||||
| -rw-r--r-- | molecule/raspberrypi/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | molecule/raspberrypi/converge.yml | 1 | ||||
| -rw-r--r-- | molecule/ubuntu/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | molecule/ubuntu/converge.yml | 1 |
8 files changed, 20 insertions, 0 deletions
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: 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: diff --git a/molecule/raspberrypi/Dockerfile.j2 b/molecule/raspberrypi/Dockerfile.j2 index b65d05ae..51d6b0dd 100644 --- a/molecule/raspberrypi/Dockerfile.j2 +++ b/molecule/raspberrypi/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/raspberrypi/converge.yml b/molecule/raspberrypi/converge.yml index 354a621d..e308f332 100644 --- a/molecule/raspberrypi/converge.yml +++ b/molecule/raspberrypi/converge.yml @@ -20,6 +20,7 @@ - name: "Configure" hosts: "raspberrypi" gather_facts: true + remote_user: "{{ username }}" environment: PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" vars: diff --git a/molecule/ubuntu/Dockerfile.j2 b/molecule/ubuntu/Dockerfile.j2 index 64070d4d..4c8e5c8c 100644 --- a/molecule/ubuntu/Dockerfile.j2 +++ b/molecule/ubuntu/Dockerfile.j2 @@ -25,6 +25,10 @@ RUN rm -f /lib/systemd/system/getty.target # Mimic Ubuntu OS default boot (for testing) RUN systemctl enable avahi-daemon +# 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/ubuntu/converge.yml b/molecule/ubuntu/converge.yml index 25b2a186..1052b483 100644 --- a/molecule/ubuntu/converge.yml +++ b/molecule/ubuntu/converge.yml @@ -20,6 +20,7 @@ - name: "Configure" hosts: "ubuntu" gather_facts: true + remote_user: "{{ username }}" environment: PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" vars: |
