Skip to content

Ansible 2.19 - galera_cluster_nodes is handled as string instead of list #265

@metrax

Description

@metrax

Describe the bug
Since upgrading to Ansible 2.19 (Jinja2 3.1+), the variable galera_cluster_nodes is rendered as a string instead of a list. This breaks templates that expect a list (e.g., building wsrep_cluster_address), because lookups iterate over characters of the string rather than hosts.

To Reproduce

  • Upgrade to Ansible 2.19.
  • Run the role with a populated galera_cluster_nodes_group.
  • Observe generated config: wsrep_cluster_address is empty/incorrect because galera_cluster_nodes is a string, not a list.

Expected behavior
galera_cluster_nodes is a proper list constructed from the inventory group.

Additional context
Workaround / Fix:
Use the inventory group directly and cast to list:

--- a/vars/main.yml
+++ b/vars/main.yml
@@ -1,9 +1,4 @@
 ---
 # vars file for ansible-mariadb-galera-cluster
 
-galera_cluster_nodes: "\
-  {% set _galera_cluster_nodes = [] %}\
-  {% for host in groups[ galera_cluster_nodes_group ] %}\
-  {{   _galera_cluster_nodes.append( host )|default('', True) }}\
-  {% endfor %}\
-  {{ _galera_cluster_nodes }}"
+galera_cluster_nodes: "{{ groups[galera_cluster_nodes_group] | list }}"

This is backward compatible with >2.14 (not tested with older version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions