summaryrefslogtreecommitdiffstats
path: root/molecule/debian
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-12-11 17:27:15 +0100
committerAhmed Abdelhalim <[email protected]>2025-12-11 22:05:56 +0100
commit5e40d4a6ffa1667412d5db10ad6c99338dfec544 (patch)
treeb48046cdbc7b26607ed884403b4414ddb17dbd00 /molecule/debian
parenta2a191770cc68371228bfba036ef8363fc11ee3c (diff)
Fix the test_group passwordless permission for testing
Diffstat (limited to 'molecule/debian')
-rw-r--r--molecule/debian/Dockerfile.j24
-rw-r--r--molecule/debian/converge.yml9
2 files changed, 8 insertions, 5 deletions
diff --git a/molecule/debian/Dockerfile.j2 b/molecule/debian/Dockerfile.j2
index 3a5642a9..2e047439 100644
--- a/molecule/debian/Dockerfile.j2
+++ b/molecule/debian/Dockerfile.j2
@@ -20,10 +20,6 @@ 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 7fcfbce6..86e9e059 100644
--- a/molecule/debian/converge.yml
+++ b/molecule/debian/converge.yml
@@ -16,6 +16,13 @@
- role: "user"
- role: "ssh"
- role: "password_policy"
+ tasks:
+ - name: "Configure passwordless sudo for testing"
+ ansible.builtin.copy:
+ content: "%test_group ALL=(ALL) NOPASSWD: ALL\n"
+ dest: "/etc/sudoers.d/test_group"
+ mode: "0440"
+ validate: 'visudo -cf %s'
- name: "Configure"
hosts: "debian"
@@ -24,7 +31,7 @@
environment:
PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}"
vars:
- ansible_become_method: su
+ ansible_become_method: sudo
locales:
- "en_US.UTF-8 UTF-8"
timezone: "GMT"