Unify and standardize inventory_hostname

This was causing some confusing conflicts, so create a new fact called
"this_node" which is inventory_hostname.split('.')[0], i.e. the short
name, and use that everywhere instead of an FQDN or true inventory
hostname.
This commit is contained in:
2023-09-01 15:42:28 -04:00
parent 5de3ab0c3a
commit d24cb8a8ef
11 changed files with 47 additions and 37 deletions

View File

@ -3,9 +3,9 @@ namespace: /patroni/
name: {{ ansible_hostname }}
restapi:
listen: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.cluster_ip }}:8008'{% endfor %}
listen: {% for node in pvc_nodes if node.hostname == this_node %}'{{ node.cluster_ip }}:8008'{% endfor %}
connect_address: {% 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 == this_node %}'{{ node.cluster_ip }}:8008'{% endfor %}
zookeeper:
hosts: [ {% for node in pvc_nodes if node.is_coordinator %}"{{ node.cluster_ip }}:2181"{% if not loop.last %},{% endif %}{% endfor %} ]
@ -44,7 +44,7 @@ bootstrap:
postgresql:
listen: '0.0.0.0:5432'
connect_address: {% for node in pvc_nodes if node.hostname == inventory_hostname %}'{{ node.cluster_ip }}:5432'
connect_address: {% for node in pvc_nodes if node.hostname == this_node %}'{{ node.cluster_ip }}:5432'
{% endfor %}
log_destination: 'stderr'
log_min_messages: INFO