Closed erplus closed 1 week ago
So, after some investigation: You should have do something like this for Quadlet file:
[Service]
# Restart service when sleep finishes
Restart=always
according to Podman docs example here.
So in our collection you just add a Service
section (or any other):
- name: Podman pod test
hosts: molecule-podman-*
gather_facts: false
become: true
tasks:
- name: Create a pod
containers.podman.podman_pod:
name: xyz
state: quadlet
quadlet_options:
- |
[Service]
Restart=no
Podman options like restart: no
are not reflected in Service
, Quadlet doesn't pass it there.
Although in this case I see they just override this section with hardcoded values here:
https://github.com/containers/podman/blob/2aacd4e212525db4ee06be8e44e4405400d4df9d/pkg/systemd/quadlet/quadlet.go#L1652C2-L1657C3
service.Setv(ServiceGroup,
"Environment", "PODMAN_SYSTEMD_UNIT=%n",
"Type", "forking",
"Restart", "on-failure",
"PIDFile", "%t/%N.pid",
)
So I suppose you should submit a bug/rfe for Podman to enable custom Restart
values.
Closing it since it's not collection issue
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
When i use podman_pod module with state=quadlet then generated unit in systemd always has
Restart=on-failure
under[Service]
section. Changing module parameterrestart_policy: "no"
or evengenerate_systemd['restart_policy']: "no"
(but in my opinion this is not proper parameter for quadlet) doesn't help.Steps to reproduce the issue:
Deploy a pod with
name: xyz
,state: quadlet
andrestart_policy: "no"
Run
systemctl cat xyz-pod
Describe the results you received: In a systemd definition under
[Service]
is setRestart=on-failure
Describe the results you expected: In a systemd definition under
[Service]
is setRestart=no
Additional information you deem important (e.g. issue happens only occasionally):
Version of the
containers.podman
collection: Either git commit if installed from git:git show --summary
Or version fromansible-galaxy
if installed from galaxy:ansible-galaxy collection list | grep containers.podman
Output of
ansible --version
:Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Playbok you run with ansible (e.g. content of
playbook.yaml
):Command line and output of ansible run with high verbosity
Please NOTE: if you submit a bug about idempotency, run the playbook with
--diff
option, like:ansible-playbook -i inventory --diff -vv playbook.yml
Additional environment details (AWS, VirtualBox, physical, etc.):