Repository navigation
fix(docs): update the systemd container guide to use podman's systemd mode - #4680
Conversation
The systemd container guide used the pre ansible-native platforms/driver model (command: /sbin/init plus tmpfs and a /sys/fs/cgroup volume mount). Rewrite it for the native model as a delta on the existing "Using podman containers" example: making that inventory-driven scenario systemd-capable is an init image per host plus two shared inventory group vars (container_command: /sbin/init, container_systemd: always). Converge applies the role under test (include_role) and verify asserts the service it manages is active. The inventory covers UBI 10 init and CentOS Stream 10. Extended privileges reuse the example's container_capabilities / container_privileged. Refs ansible#4679 Assisted-by: Claude (Anthropic) Signed-off-by: Jeff Pullen <9343691+jeffcpullen@users.noreply.github.com>
📝 WalkthroughWalkthroughThe systemd container guide now documents inventory-driven Podman configuration, init images, cgroup requirements, converge and verify playbooks, privilege settings, seccomp limits, security warnings, and troubleshooting steps. ChangesSystemd container guide
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The PR was retitled docs: -> fix(docs): to satisfy the ack label gate, but the autolabeler only fires on synchronize, not on a title edit. This empty commit triggers it so the fix label is applied. Squashed away on merge. Assisted-by: Claude (Anthropic) Signed-off-by: Jeff Pullen <9343691+jeffcpullen@users.noreply.github.com>
|
Codecov is still pending because this is a docs-only change and there is no source-code coverage for Codecov to report. All other CI checks are passing. As this PR only updates documentation, we're bypassing the Codecov requirement to proceed with the merge. |
Part of #4679.
What
Rewrites
docs/guides/systemd-container.mdto show the current way to run a systemd-capable test container. The old guide configured systemd through aplatforms:block (command: /sbin/initplustmpfsand a/sys/fs/cgroupvolume mount) driven by the Docker driver, which now lives in the external molecule-plugins collection rather than in Molecule.Rather than introduce a second, competing scenario, the rewrite builds on the existing Using podman containers example, whose
create.ymlis already driven by inventory variables (container_image,container_command,container_systemd,container_capabilities,container_privileged). Making that scenario systemd-capable is an inventory change, not a newcreate.yml: point each host at an init image, and set two shared group variables in the same inventory file:The guide then swaps the example's OS-checking converge and verify: converge applies the role under test (
include_role), and verify asserts the service that role manages is active. Extended privileges reuse the example'scontainer_capabilities/container_privileged.Why
Testing a role that manages services needs systemd running as PID 1, which a plain container does not provide. As written, the guide points readers at a Docker-driver configuration that Molecule no longer ships.
Verification
I built the scenario the guide describes on top of the
Using podman containersexample: its exactcreate.yml,destroy.yml, andcleanup.yml, the systemd inventory changes above, and theconverge/verifyplaybooks shown in the guide.converge.ymlappliesyour_role; the proof scenario stands that in with a small role that installs and starts a unit, the way a real service-managing role would. The inventory has two hosts so the guide is exercised across distributions:ubi10(registry.access.redhat.com/ubi10/ubi-init:latest) andcentos-stream10(quay.io/centos/centos:stream10). Environment: Molecule 26.6.0 on Python 3.14,containers.podman1.20.2.molecule testpasses the full sequence on both hosts and is idempotent:molecule test, full sequence, exit 0, both hostsBoth hosts run the role, are idempotent (
changed=0on the second pass), andverify.ymlasserts the managed service is active viaservice_factson each.The guide tells readers to override
container_commandto the image's init. That instruction is load-bearing, so I confirmed the failure it prevents: withcontainer_commandleft at the example's default (sleep 1d) and onlycontainer_systemd: alwaysset, the role's service task fails becausesystemdis not PID 1:Without the
container_commandoverride, converge fails as documentedansible-lintis clean at the production profile (run withcontainers.podmaninstalled fromrequirements.yml):ansible-lint, clean at the production profiletox -e docsrenders the guide with no errors of its own; the Jinja in the YAML examples is wrapped in{% raw %}so the mkdocs-macros plugin renders it. The--strictbuild currently aborts on one external error, mkdocstrings loadinghttps://docs.ansible.com/projects/ansible/latest/objects.inv(HTTP 429), which is unrelated to this diff and hits real CI identically.Scope
I kept this to the one guide so it is easy to review. Five other pages still use the legacy
platforms:/driver:/provisioner:syntax (docker-rootless,podman-inside-docker,sharing,monolith, andci.md); I opened #4679 to agree the direction before converting them. I am happy to do them the same way, building and running each, as follow-ups.Summary by CodeRabbit