ansible-role-patroni icon indicating copy to clipboard operation
ansible-role-patroni copied to clipboard

AnsibleUndefinedVariable dict object has no attribute etcd

Open patsevanton opened this issue 6 years ago • 4 comments

I dont know how fix it.

TASK [retr0h.etcd : Add etcd systemd service] ***************************************************************************************************
fatal: [ubuntu1]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute u'etcd'"}
fatal: [ubuntu2]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute u'etcd'"}
fatal: [ubuntu3]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute u'etcd'"}
cat patroni.yml 
- hosts: patroni
  become: yes
  roles:
    - kostiantyn-nemchenko.patroni

patsevanton avatar Nov 14 '18 17:11 patsevanton

Can i use another role for etcd ? For example: https://galaxy.ansible.com/andrewrothstein/etcd-cluster

patsevanton avatar Nov 15 '18 07:11 patsevanton

fatal: [ubuntu1]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'dict object' has no attribute u'etcd'"

Seems like you don't have etcd group in your inventory file for ansible.

Please, add something like the following:

[etcd]
ubuntu1 ansible_host=XXX.XXX.XXX.XXX
ubuntu2 ansible_host=XXX.XXX.XXX.XXX
ubuntu3 ansible_host=XXX.XXX.XXX.XXX

Can i use another role for etcd ?

Sure, just set patroni_dcs_exists to true and provide the correct values for etcd related settings.

kostiantyn-nemchenko avatar Nov 15 '18 09:11 kostiantyn-nemchenko

OMG. May be add

[etcd]
ubuntu1 ansible_host=XXX.XXX.XXX.XXX
ubuntu2 ansible_host=XXX.XXX.XXX.XXX
ubuntu3 ansible_host=XXX.XXX.XXX.XXX

to readme?

patsevanton avatar Nov 15 '18 09:11 patsevanton

It makes sense. But respective groups for zookeeper and consul should be added as well.

kostiantyn-nemchenko avatar Nov 18 '18 11:11 kostiantyn-nemchenko