grafana-ansible-collection icon indicating copy to clipboard operation
grafana-ansible-collection copied to clipboard

Declare `grafana.grafana` collection dependencies on `galaxy.yml`

Open kysrpex opened this issue 1 year ago • 3 comments

Hello!

I have encountered the following issue while running the role grafana.grafana.grafana.

TASK [grafana.grafana.grafana : Datasources] ************************************************************************************************************************************
ERROR! couldn't resolve module/action 'community.grafana.grafana_datasource'. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in '/home/.../collections/ansible_collections/grafana/grafana/roles/grafana/tasks/datasources.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: "Ensure datasources exist (via API)"
  ^ here

Link to the offending line.

The reason is clear: the collection community.grafana is missing. As far as I understand from the presence of a requirements.yml file in the repository, the collections community.general, community.grafana and ansible.posix are dependencies of the collection grafana.grafana. Installing community.grafana fixes the issue.

However, would it not make sense to use the dependencies key of the galaxy.yml file, as the Ansible documentation explains?

kysrpex avatar Jun 12 '24 13:06 kysrpex

@gardar Why do we have that dependency? Last I checked it was just for CI?

ishanjainn avatar Jun 25 '24 13:06 ishanjainn

Just had this issue using latest grafana.grafana

TASK [grafana.grafana.grafana : Datasources] ***************************************************************************************** ERROR! couldn't resolve module/action 'community.grafana.grafana_datasource'. This often indicates a misspelling, missing collection, or incorrect module path.

My inventory var: `grafana_datasources:

  • name: '{{ inventory_hostname }}' type: prometheus access: proxy url: 'http://{{ inventory_hostname }}:9090'`

P4R4DiSi4C avatar Dec 06 '24 17:12 P4R4DiSi4C

My .2c: grafana.grafana should be >=4.0.0.

jwarnier avatar Jan 16 '25 12:01 jwarnier