--- - name: Create Consul service definition include_role: name=infra-role-consul-service vars: consul_config_name: '{{ postgres_ha_service_name }}' consul_services: - id: '{{ postgres_ha_service_name }}' name: '{{ postgres_ha_consul_service }}' tags: ['postgres', 'database'] port: '{{ postgres_ha_cont_port }}' checks: - id: '{{ postgres_ha_service_name }}-status' name: 'PostgreSQL DB Healthcheck' type: 'tcp' tcp: 'localhost:{{ postgres_ha_cont_port }}' - id: '{{ postgres_ha_service_name }}-{{ postgres_ha_replica_enabled | ternary("replica", "tables") }}' name: 'PostgreSQL {{ postgres_ha_replica_enabled | ternary("Replica", "Tables") }} Healthcheck' type: 'script' script: '{{ postgres_ha_service_path }}/health.sh'