2023-12-21 16:30:57 +00:00
|
|
|
# {{ ansible_managed }}
|
|
|
|
|
|
|
|
[Unit]
|
2024-02-12 16:02:30 +00:00
|
|
|
Description=Podman container: {{ container.name }}
|
2024-03-25 18:28:21 +00:00
|
|
|
{% for extra in container.get('unit_extras', []) %}
|
|
|
|
{{ extra }}
|
2024-02-12 16:02:30 +00:00
|
|
|
{% endfor %}
|
2023-12-21 16:30:57 +00:00
|
|
|
|
|
|
|
[Container]
|
|
|
|
HostName={{ inventory_hostname }}
|
|
|
|
|
|
|
|
Image={{ container.image }}
|
|
|
|
ContainerName={{ container.name }}
|
|
|
|
|
|
|
|
{% if container.get('userns', '') | length > 0 %}
|
|
|
|
UserNS={{ container.userns }}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
AutoUpdate=registry
|
|
|
|
|
2024-05-06 13:08:54 +00:00
|
|
|
{% for cmd in container.get('commands', []) %}
|
|
|
|
Exec={{ cmd }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2023-12-21 16:30:57 +00:00
|
|
|
{% for volume in container.get('volumes', []) %}
|
|
|
|
Volume={{ volume }}
|
|
|
|
{% endfor %}
|
|
|
|
|
2024-03-04 12:36:57 +00:00
|
|
|
{% for mount in container.get('mounts', []) %}
|
|
|
|
{% if mount.get('options', []) | length > 0 %}
|
|
|
|
Mount=type={{ mount.type }},src={{ mount.source }},dst={{ mount.destination }},{{ mount.options | join(',') }}
|
|
|
|
{% else %}
|
|
|
|
Mount=type={{ mount.type }},src={{ mount.source }},dst={{ mount.destination }}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
|
2023-12-21 16:30:57 +00:00
|
|
|
{% for port in container.get('ports', []) %}
|
|
|
|
PublishPort={{ port }}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for environment in container.get('environment_vars', []) %}
|
|
|
|
Environment={{ environment }}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
Restart=on-failure
|
|
|
|
TimeoutStartSec=900
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=default.target
|