ansible-edda/playbooks/roles/services/deploy/pod/templates/container.service

47 lines
1.7 KiB
Desktop File

[Unit]
Description=Podman %n
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
BindsTo={{ services_deploy_pod_container_binds_to | join(" ") }}
After={{ services_deploy_pod_container_binds_to | join(" ") }}
{% if services_deploy_pod_container_requires %}
Requires={{ services_deploy_pod_container_requires | join(" ") }}
After={{ services_deploy_pod_container_requires | join(" ") }}
{% endif %}
{% if services_deploy_pod_container_wants %}
Wants={{ services_deploy_pod_container_wants | join(" ") }}
Before={{ services_deploy_pod_container_wants | join(" ") }}
{% endif %}
OnFailure=status-mail@%n.service
[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=on-failure
TimeoutStopSec=70
{% for exec_start_pre in (services_deploy_pod_container.exec_start_pre | default([])) %}
ExecStartPre={{ exec_start_pre }}
{% endfor %}
ExecStartPre=/bin/rm -f %t/%N.pid %t/%N.ctr-id
ExecStart=/usr/bin/podman run \
--conmon-pidfile %t/%N.pid \
--cidfile %t/%N.ctr-id \
--cgroups=no-conmon \
--pod-id-file %t/pod-{{ services_service_name }}.pod-id \
--replace \
--label "io.containers.autoupdate=image" \
--log-driver=journald \
-dt \
-v {{ system_etc_root_directory }}/resolv.conf:/etc/resolv.conf:ro \
{% for podman_run_arg in (services_deploy_pod_container.podman_run_args | default([])) %}
{{ podman_run_arg }} \
{% endfor %}
--name=%N \
{{ services_deploy_pod_container.image }}{%
for cmd_arg in (services_deploy_pod_container.cmd_args | default([])) %} \
{{ cmd_arg }}{% endfor %}{{ '' }}
ExecStop=/usr/bin/podman stop --ignore --cidfile %t/%N.ctr-id -t 10
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/%N.ctr-id
PIDFile=%t/%N.pid
Type=forking