From 8cc111819b5d2f2cdfdc9ca754afbea49c60fb0d Mon Sep 17 00:00:00 2001 From: Logan V Date: Fri, 14 Apr 2017 12:37:52 -0500 Subject: [PATCH] Use the correct cluster addresses for node list The cluster address list is broken when the wsrep node address is not ansible_host. Change-Id: I75b1fdb0332aa3102ed3841b84025207c52e242b --- defaults/main.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 36253d1f..3bcc31c5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -69,7 +69,16 @@ galera_innodb_log_buffer_size: 128M ## wsrep configuration galera_wsrep_address: "{{ ansible_host }}" -galera_wsrep_cluster_address: "{% if galera_cluster_members | length > 1 %}{% for host in galera_cluster_members %}{{ hostvars[host]['ansible_host'] }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %}" +galera_wsrep_cluster_address: >- + {% set _var = [] -%} + {% for cluster_host in galera_cluster_members -%} + {% set _addr = hostvars[cluster_host]['galera_wsrep_address'] + | default(hostvars[cluster_host]['ansible_host']) -%} + {% if _var.append(_addr) %}{% endif -%} + {% endfor -%} + {# If only 1 cluster member is present output an empty string so the + single-node member will re-bootstrap correctly upon restart #} + {{ _var | join(',') if galera_cluster_members | length > 1 else '' }} galera_wsrep_node_incoming_address: "{{ galera_wsrep_address }}" ## Cap the maximum number of threads / workers when a user value is unspecified. galera_wsrep_slave_threads_max: 16