ansible-mariadb-galera-cluster
ansible-mariadb-galera-cluster copied to clipboard
dict object' has no attribute 'galera-cluster-nodes
Hi!
I'm new in ansible, and I try to install a galera cluster on my test enviroment. But I have this error:
Traceback (most recent call last): File "/usr/local/Cellar/ansible/6.1.0/libexec/lib/python3.10/site-packages/ansible/template/init.py", line 1096, in do_template res = self.environment.concat(rf) File "/usr/local/Cellar/ansible/6.1.0/libexec/lib/python3.10/site-packages/ansible/template/native_helpers.py", line 70, in ansible_eval_concat head = list(islice(nodes, 2)) File "", line 16, in root File "/usr/local/Cellar/ansible/6.1.0/libexec/lib/python3.10/site-packages/jinja2/runtime.py", line 852, in _fail_with_undefined_error raise self._undefined_exception(self._undefined_message) jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'galera-cluster-nodes'
I tried to find out what was the problem, but I wont find this variable anywhere.
Ansible version: ansible [core 2.13.1] config file = None configured module search path = ['/Users/imagyar/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/Cellar/ansible/6.1.0/libexec/lib/python3.10/site-packages/ansible ansible collection location = /Users/imagyar/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.10.5 (main, Jun 23 2022, 17:15:25) [Clang 13.1.6 (clang-1316.0.21.2.5)] jinja version = 3.1.2 libyaml = True
playbook.yml:
- name: Example Playbook
hosts: all
tasks:
- name: Include ansible-mariadb-galera-cluster include_role: name: mrlesmithjr.mariadb_galera_cluster
Thanks!
Hello @zaraquer,
You need to overwrite the value from defaults named galera_cluster_nodes_group
and use there the actual name of the group where the galera cluster should be installed.
My galera cluster override file is something along these lines:
---
galera_cluster_bind_interface: 'eth0' # make sure this interface exists in your servers
# yamllint disable-line rule:line-length
galera_cluster_name: 'clients_mariadb_gc_staging' # this name should be under 32 chars or galera cluster will not start
galera_cluster_nodes_group: 'clients_mariadb_galera_cluster' ## this is the most important one
mariadb_version: '10.6'
mariadb_mysql_root_password: "some-password"
Hi @eRadical !
Thanks for your comment! I already named it after the group name in my inventory file.
Define the name of the cluster
galera_cluster_name: "galera-test"
Define Ansible group in which the nodes exist to be part of the cluster
galera_cluster_nodes_group: "mariadb"
Inventory file: [mariadb] mariadb1 ansible_host=xxx.xxx.xxx.51 mariadb2 ansible_host=xxx.xxx.xxx.52 mariadb3 ansible_host=xxx.xxx.xxx.53
[all:vars] ansible_python_interpreter=/usr/bin/python3
@zaraquer - any progress on this?
Can you paste a file with ansible-playbook ran with "-vvvv" ?
@eRadical
Hi!
I figured out, there was a missing quote in the main.yml and needed to change some values. It seems it solved now.
Glad you sorted it out.