How to test deploy of Podman Quadlet using Ansible Molecule with host provided by Podman

I’m trying to create a role that deploys one application using Podman Quadlet and I want to test the role using Molecule with host provided by Podman. This means that, during test, the application with be deployed in a “Podman in Podman” scenario.

When Ansible Molecule runs containers.podman.podman_quadlet, it reports the error

connecting to systemd dbus: dial unix /run/systemd/private: connect: no such file or directory

I’m using the container image quay.io/podman/stable:latest as documented in image_build/podman at main · podman-container-tools/image_build · GitHub and running the container as privileged.

Any example for me to use as reference? Or suggestions on how to resolve the error?

Complete role available in podiru/traefik: Ansible role to deploy Traefik using Podman Quadlet - Codeberg.org

Thanks!

Hi @rgaiacs

I’m on mobile right now but my guess is that the image quay.io/podman/stable:latest doesn’t start systemd as PID 1, so systemd is not running.

Can you please try using the instructions outlined in the Molecule documentation for running systemd in a container using podman: Systemd container - Ansible Molecule

Hi @dbrennand,

Thanks for the reply and to point to the part of the documentation that I forgot.

I believe that my problem is due to Windows Subsystem for Linux (WSL). I forgot to mention this in the original post because I always forgot that some things does not works as expected on WSL, for example systemctl --user status failing due to `/run/user/<UID>` being incorrectly set up · Issue #13143 · microsoft/WSL · GitHub and [WSL 2.9 regression] Rootless Docker/Podman cannot start any container — standard /sys/fs/cgroup/user.slice path missing after cgroup hierarchy moved under /wsl-user/distro-N/ · Issue #41492 · microsoft/WSL · GitHub.

I will have to check on my bare metal GNU/Linux machine.