add consul service definition

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-11-24 20:43:14 +01:00
parent 80e572044e
commit bf8662b20f
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 20 additions and 0 deletions

View File

@ -35,6 +35,9 @@ postgres_ha_databases: []
# user: 'dbuser'
# pass: 'dbpass'
# Consul
postgres_ha_consul_service: 'postgres'
# general container management
compose_recreate: 'smart'
compose_state: 'present'

15
tasks/consul.yml Normal file
View File

@ -0,0 +1,15 @@
---
- name: Create Consul service definition
include_role: name=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 }}'

View File

@ -20,3 +20,5 @@
with_items: '{{ postgres_ha_databases }}'
loop_control:
loop_var: db
- import_tasks: consul.yml