From e40a63f465bf2ad045afd054b7a27ffe8eed5296 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Fri, 12 Sep 2025 17:17:30 +0200 Subject: Fix the testing of gateway role in containers/CI --- molecule/archlinux/Dockerfile.j2 | 3 +-- molecule/debian/Dockerfile.j2 | 2 +- molecule/raspberrypi/Dockerfile.j2 | 2 +- molecule/ubuntu/Dockerfile.j2 | 8 ++++---- roles/gateway/README.md | 4 ++-- roles/gateway/tasks/main.yml | 1 + 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/molecule/archlinux/Dockerfile.j2 b/molecule/archlinux/Dockerfile.j2 index 1d5a1cd5..3dc35f2d 100644 --- a/molecule/archlinux/Dockerfile.j2 +++ b/molecule/archlinux/Dockerfile.j2 @@ -2,7 +2,7 @@ FROM docker.io/library/archlinux ENV container docker -RUN pacman -Syu --noconfirm --needed python3 \ +RUN pacman -Syu --noconfirm --needed python3 systemd udev \ && pacman -Scc --noconfirm RUN (cd /lib/systemd/system/sysinit.target.wants/; \ @@ -10,7 +10,6 @@ RUN (cd /lib/systemd/system/sysinit.target.wants/; \ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ - rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ rm -f /lib/systemd/system/basic.target.wants/*;\ rm -f /lib/systemd/system/anaconda.target.wants/*; diff --git a/molecule/debian/Dockerfile.j2 b/molecule/debian/Dockerfile.j2 index aa620c58..26e0dc9e 100644 --- a/molecule/debian/Dockerfile.j2 +++ b/molecule/debian/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV container docker RUN apt-get update \ && apt-get install -y --no-install-recommends \ - systemd python3 avahi-daemon iproute2 ifupdown \ + systemd python3 avahi-daemon iproute2 ifupdown udev \ && rm -Rf /var/lib/apt/lists/* \ && rm -Rf /usr/share/doc \ && rm -Rf /usr/share/man \ diff --git a/molecule/raspberrypi/Dockerfile.j2 b/molecule/raspberrypi/Dockerfile.j2 index aa620c58..26e0dc9e 100644 --- a/molecule/raspberrypi/Dockerfile.j2 +++ b/molecule/raspberrypi/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV container docker RUN apt-get update \ && apt-get install -y --no-install-recommends \ - systemd python3 avahi-daemon iproute2 ifupdown \ + systemd python3 avahi-daemon iproute2 ifupdown udev \ && rm -Rf /var/lib/apt/lists/* \ && rm -Rf /usr/share/doc \ && rm -Rf /usr/share/man \ diff --git a/molecule/ubuntu/Dockerfile.j2 b/molecule/ubuntu/Dockerfile.j2 index 37199b55..a8e90a48 100644 --- a/molecule/ubuntu/Dockerfile.j2 +++ b/molecule/ubuntu/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV container docker RUN apt-get update \ && apt-get install -y --no-install-recommends \ - locales systemd avahi-daemon python3 iproute2 ifupdown \ + locales systemd avahi-daemon python3 iproute2 ifupdown udev \ && rm -Rf /var/lib/apt/lists/* \ && rm -Rf /usr/share/doc \ && rm -Rf /usr/share/man \ @@ -17,10 +17,10 @@ RUN apt-get update \ # Fix potential UTF-8 errors with ansible-test. RUN locale-gen en_US.UTF-8 -# Remove unnecessary getty and udev targets that result in high CPU usage when using +# Remove unnecessary getty target that result in high CPU usage when using # multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104) -RUN rm -f /lib/systemd/system/systemd*udev* \ - && rm -f /lib/systemd/system/getty.target +# Keeping the udev because the gateway role depends on that +RUN rm -f /lib/systemd/system/getty.target # Mimic Ubuntu OS default boot (for testing) RUN systemctl enable avahi-daemon diff --git a/roles/gateway/README.md b/roles/gateway/README.md index 97ebf682..ee6488c4 100644 --- a/roles/gateway/README.md +++ b/roles/gateway/README.md @@ -82,8 +82,8 @@ journalctl -u gateway-direct-mode.service -f ```bash # Verify iptables rules -iptables -L -n -v -iptables -t nat -L -n -v +sudo iptables -L -n -v +sudo iptables -t nat -L -n -v # Check WireGuard interface detection ip link show | grep wg diff --git a/roles/gateway/tasks/main.yml b/roles/gateway/tasks/main.yml index f0bdb4d4..a571dd52 100644 --- a/roles/gateway/tasks/main.yml +++ b/roles/gateway/tasks/main.yml @@ -5,6 +5,7 @@ name: - "iptables" - "iproute2" + - "udev" state: "present" - name: "Configure IP forwarding" -- cgit v1.2.3