Use IPs for Patroni configuration

This commit is contained in:
Joshua Boniface 2021-06-22 03:25:14 -04:00
parent ae45da3f85
commit 84bf1d7efa
1 changed files with 6 additions and 5 deletions

View File

@ -3,11 +3,12 @@ namespace: /patroni/
name: {{ ansible_hostname }} name: {{ ansible_hostname }}
restapi: restapi:
listen: '0.0.0.0:8008' listen: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.cluster_ip }}:8008'{% endfor %}
connect_address: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.hostname.split('.')[0] }}.{{ pvc_cluster_domain }}:8008'{% endfor %}
connect_address: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.cluster_ip }}:8008'{% endfor %}
zookeeper: zookeeper:
hosts: [ {% for node in pvc_nodes if node.is_coordinator %}"{{ node.hostname.split('.')[0] }}.{{ pvc_cluster_domain }}:2181"{% if not loop.last %},{% endif %}{% endfor %} ] hosts: [ {% for node in pvc_nodes if node.is_coordinator %}"{{ node.cluster_ip }}:2181"{% if not loop.last %},{% endif %}{% endfor %} ]
bootstrap: bootstrap:
dcs: dcs:
@ -30,7 +31,7 @@ bootstrap:
- local all all peer - local all all peer
- host replication replicator 127.0.0.1/32 trust - host replication replicator 127.0.0.1/32 trust
{% for node in pvc_nodes if node.is_coordinator %} {% for node in pvc_nodes if node.is_coordinator %}
- host replication replicator {{ node.hostname.split('.')[0] }}.{{ pvc_cluster_domain }} trust - host replication replicator {{ node.cluster_ip }} trust
{% endfor %} {% endfor %}
- host all all 0.0.0.0/0 md5 - host all all 0.0.0.0/0 md5
@ -43,7 +44,7 @@ bootstrap:
postgresql: postgresql:
listen: '0.0.0.0:5432' listen: '0.0.0.0:5432'
connect_address: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.hostname.split('.')[0] }}.{{ pvc_cluster_domain }}:5432' connect_address: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.cluster_ip }}:5432'
{% endfor %} {% endfor %}
log_destination: 'stderr' log_destination: 'stderr'
log_min_messages: INFO log_min_messages: INFO