50 lines
1.2 KiB
Django/Jinja
50 lines
1.2 KiB
Django/Jinja
[Unit]
|
|
Description={{ container_name }} Podman Container
|
|
{% for unit in systemd_After %}
|
|
After={{ unit }}
|
|
{% endfor %}
|
|
{% for unit in systemd_Before %}
|
|
Before={{ unit }}
|
|
{% endfor %}
|
|
{% for unit in systemd_Conflicts %}
|
|
Conflicts={{ unit }}
|
|
{% endfor %}
|
|
{% for unit in systemd_Requires %}
|
|
Requires={{ unit }}
|
|
{% endfor %}
|
|
{% for unit in systemd_Wants %}
|
|
Wants={{ unit }}
|
|
{% endfor %}
|
|
|
|
[Service]
|
|
Type=forking
|
|
TimeoutStartSec={{ systemd_TimeoutStartSec }}
|
|
ExecStartPre=-/usr/bin/podman pod rm -f {{ container_name }}
|
|
{% if container_run_as_user == 'root' %}
|
|
User={{ container_run_as_user }}
|
|
{% endif %}
|
|
RemainAfterExit=yes
|
|
|
|
ExecStart=/usr/bin/podman play kube {{ container_pod_yaml }}
|
|
|
|
ExecReload=-/usr/bin/podman pod stop {{ container_name }}
|
|
ExecReload=-/usr/bin/podman pod rm -f {{ container_name }}
|
|
ExecStop=-/usr/bin/podman pod rm -f {{ container_name }}
|
|
Restart={{ container_restart }}
|
|
RestartSec={{ systemd_RestartSec }}
|
|
Environment=PODMAN_SYSTEMD_UNIT=%n
|
|
|
|
[Install]
|
|
{% if container_run_as_user == 'root' %}
|
|
WantedBy=multi-user.target
|
|
{% endif %}
|
|
{% if container_run_as_user != 'root' %}
|
|
WantedBy=default.target
|
|
{% endif %}
|
|
{% for unit in systemd_RequiredBy %}
|
|
RequiredBy={{ unit }}
|
|
{% endfor %}
|
|
{% for unit in systemd_WantedBy %}
|
|
WantedBy={{ unit }}
|
|
{% endfor %}
|