ceph / cephmetrics

ceph metric collectors with collectd integration
GNU Lesser General Public License v3.0
65 stars 32 forks source link

'dict object' has no attribute 'datasource' #152

Open jbiao opened 6 years ago

jbiao commented 6 years ago

Hello, On a fresh installation, I have the following error

TASK [ceph-grafana : Set grafana_data_source] *** task path: /usr/share/cephmetrics-ansible/roles/ceph-grafana/tasks/configure_grafana.yml:51 fatal: [dell-per320-04.rhts.gsslab.pek.redhat.com]: FAILED! => { "failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'datasource'\n\nThe error appears to have been in '/usr/share/cephmetrics-ansible/roles/ceph-grafana/tasks/configure_grafana.yml': line 51, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set grafana_data_source\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no attribute 'datasource'" }

Just added host in [ceph-grafana] from /etc/ansible/hosts, created vars.yml to pass admin password and issue the command under /usr/share/cephmetrics-ansible. ansible-playbook -v playbook.yml -e '@vars.yml'

badone commented 6 years ago

This appears to be a downstream documentation bug as the doc advocates creating a vars.yml file with the following content.

grafana:
  admin_password: redhat

This appears to override the default definition of "grafana" in roles/ceph-grafana/defaults/main.yml and results in the "'dict object' has no attribute 'datasource'" error. A workaround appears to be adding a "datasource: Local" line to vars.yml under the grafana definition.