grafana / grafana-ansible-collection

grafana.grafana Ansible collection provides modules and roles for managing various resources on Grafana Cloud and roles to manage and deploy Grafana Agent and Grafana
https://docs.ansible.com/ansible/latest/collections/grafana/grafana/index.html#plugins-in-grafana-grafana
GNU General Public License v3.0
94 stars 62 forks source link

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

Open kysrpex opened 2 weeks ago

kysrpex commented 2 weeks ago

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?

ishanjainn commented 5 days ago

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