xoxys.postgres/templates/etc/containers/systemd/postgres.container.j2
2024-08-13 09:32:28 +02:00

38 lines
968 B
Django/Jinja

#jinja2: lstrip_blocks: True
{{ ansible_managed | comment }}
[Install]
WantedBy=default.target
[Service]
Restart=on-failure
RestartSec=5s
EnvironmentFile=/etc/containers/systemd/postgres.sys.env
[Container]
Image={{ postgres_image }}
Exec=postgres $POSTGRES_ARGS
EnvironmentFile=/etc/containers/systemd/postgres.env
User={{ postgres_uid }}
Group={{ postgres_gid }}
{% for item in postgres_volumes %}
Volume={{ item.name }}:{{ item.dest }}{{ ":" + item.opts if item.opts is defined else "" }}
{% endfor %}
{% if (postgres_cap_add + postgres_cap_drop) | length > 0 %}
{% if postgres_cap_add | length > 0 %}
AddCapability={{ postgres_cap_add | join(" ") }}
{% endif %}
{% if postgres_cap_drop | length > 0 %}
DropCapability={{ postgres_cap_drop | join(" ") }}
{% endif %}
{% endif %}
Network={{ postgres_network }}
{% for item in postgres_exposed_ports %}
PublishPort={{ item }}
{% endfor %}
{% for item in postgres_podman_args %}
PodmanArgs={{ item }}
{% endfor %}