Closed patsevanton closed 2 years ago
Unfortunately, I can't reproduce this issue locally. Could you try to run playbook in more verbose mode and share output?
Run ansible-playbook -vvvv -i host.ini playbook.yml
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/ansible/template/__init__.py", line 1139, in do_template
res = j2_concat(rf)
File "<template>", line 54, in root
File "/usr/local/lib/python3.8/dist-packages/jinja2/runtime.py", line 747, in _fail_with_undefined_error
raise self._undefined_exception(self._undefined_message)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'victoria_cluster'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/ansible/plugins/action/template.py", line 150, in run
resultant = templar.do_template(template_data, preserve_trailing_newlines=True, escape_backslashes=False)
File "/usr/lib/python3/dist-packages/ansible/template/__init__.py", line 1176, in do_template
raise AnsibleUndefinedVariable(e)
ansible.errors.AnsibleUndefinedVariable: 'dict object' has no attribute 'victoria_cluster'
fatal: [vminsert0]: FAILED! => changed=false
msg: 'AnsibleUndefinedVariable: ''dict object'' has no attribute ''victoria_cluster'''
Please add the following:
vmstorage_group=vmstorage
To your anisble vars. It is required to set vmstorage_group
to name of the vmstorage nodes group in order to configure vmselect
and vminsert
connectoins to storage pool.
You can do this by either adding it into inventory:
[all:vars]
ansible_user=ubuntu
ansible_ssh_private_key_file=~/.ssh/id_rsa
vmstorage_group=vmstorage
Or adding into playbook directly:
- hosts: vmstorage,vminsert,vmselect
collections:
- victoriametrics.cluster
become: true
vars:
vmstorage_group: vmstorage
roles:
- geerlingguy.docker
- victoriametrics.cluster.victoria_cluster
vmstorage_group=vmstorage fixed issue. May be add vmstorage_group=vmstorage to default variable ?
I'm working on updating readme files for roles right now, will place a note about that for sure
vmstorage_group in https://github.com/VictoriaMetrics/ansible-playbooks/blob/master/inventory_example/group_vars/victoria_cluster.yml#L3 and in https://github.com/VictoriaMetrics/ansible-playbooks/blob/master/roles/cluster/defaults/main.yml#L27 is different
what is value correct?
Without variable vmstorage_group get error AnsibleUndefinedVariable: 'dict object' has no attribute 'cluster'.
With variable vmstorage_group.
May be change vmstorage_group in default.yml ?
Value for this variable depends on inventory format. Variable value should contain inventory group name for vmstorage
hosts.
For inventory you've provided it should be vmstorage
Ok. May be add description about variable vmstorage to readme?
Yep, already put it into role readme here - https://github.com/VictoriaMetrics/ansible-playbooks/tree/master/roles/cluster#parameters
Great!
Hello! I try install and get error
Playbook:
Inventory:
Error: