---
DEPLOYMENT_MODE: "{{ 'swarm' if (groups['svc-swarm-node'] | default([]) | length) > 1 else 'compose' }}"
SWARM_CLUSTER_AVAILABLE: "{{ (groups['svc-swarm-node'] | default([]) | length) > 0 }}"
# Exception: a role default would be invisible to the by-path include in
# roles/svc-db-openldap/tasks/01_docker.yml, which reaches into
# roles/sys-svc-compose/tasks/utils/post_deploy.yml after the role has finished.
swarm_stack_converge_retries: 600
IS_STACK_HOST: >-
{{ DEPLOYMENT_MODE == 'compose'
or inventory_hostname in (groups['svc-swarm-manager'] | default([])) }}
IS_BACKUP_HOST: >-
{{ group_names | select('match', '^svc-bkp-') | list | length > 0 }}
STACK_HOST: >-
{{ (groups['svc-swarm-manager'] | default([]))[0] | default(inventory_hostname) }}
swarm_stack_fatal_grace: 180
SWARM_INGRESS_GUARDED: "{{ swarm_ingress_endpoints.stdout_lines | swarm_ingress_published | swarm_ingress_guarded(lookup('applications') | swarm_public_ports) }}"
SWARM_INGRESS_PEERS: "{{ swarm_ingress_nodes.stdout_lines | swarm_node_addresses }}"
swarm:
manager:
advertise_addr: >-
{{ lookup('mesh_address', STACK_HOST) if (WIREGUARD_ENABLED | bool) else '' }}
network:
encryption: true
registry:
host: "{{ (groups['svc-swarm-manager'] | default([]))[0] | default('') }}"
port: 5000
SWARM_REGISTRY_PREFIX: >-
{{
(swarm.registry.host ~ ':' ~ swarm.registry.port ~ '/')
if (
DEPLOYMENT_MODE == 'swarm'
and (swarm.registry.host | length > 0)
)
else ''
}}