Add healthcheck and dependency conditions

This commit is contained in:
Corbin Bartsch 2023-10-28 17:01:51 -04:00
parent 9846f2f03a
commit cf59c5f807
Signed by: coredotbin
GPG Key ID: 32D3B80A08D93212

View File

@ -1,4 +1,7 @@
{{ ansible_managed | comment }}
##############################
# If you're seeing this, you're using a symlinked version of this role.
##############################
---
version: "{{ compose_schema_version | default('2') }}"
services:
@ -74,7 +77,12 @@ services:
{% if container.depends_on is defined %}
depends_on:
{% for dependent in container.depends_on %}
{% if dependent.condition is defined %}
{{ dependent }}:
condition: {{ dependent.condition }}
{% else %}
- {{ dependent }}
{% endif %}
{% endfor %}
{% endif %}
{% if container.hostname is defined %}
@ -154,8 +162,15 @@ services:
- {{ envfile }}
{% endfor %}
{% endif %}
{% if container.user is defined %}
user: {{ container.user }}
{% if container.healthcheck is defined %}
healthcheck:
test: {{ container.healthcheck.test }}
interval: {{ container.healthcheck.interval }}
timeout: {{ container.healthcheck.timeout }}
{% if container.healthcheck.retries is defined %}
retries: {{ container.healthcheck.retries }}
{% endif %}
start_period: {{ container.healthcheck.start_period }}
{% endif %}
{% if container.restart is defined %}
restart: {{ container.restart }}