grafana.grafana.datasource module – Manage Data sources in Grafana
Note
This module is part of the grafana.grafana collection (version 0.0.7).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install grafana.grafana
.
To use it in a playbook, specify: grafana.grafana.datasource
.
New in version 0.0.1: of grafana.grafana
Synopsis
Create, Update and delete Data sources using Ansible.
Requirements
The below requirements are needed on the host that executes this module.
requests >= 1.0.0
Parameters
Parameter |
Comments |
---|---|
JSON source code for the Data source |
|
CLoud API Key to authenticate with Grafana Cloud. |
|
Name of the Grafana Cloud stack to which the data source will be added |
|
State for the Grafana CLoud stack. Choices:
|
Examples
- name: Create/Update Data sources
grafana.grafana.datasource:
datasource: "{{ lookup('ansible.builtin.file', 'datasource.json') }}"
stack_slug: "{{ stack_slug }}"
grafana_api_key: "{{ grafana_api_key }}"
state: present
- name: Delete Data sources
grafana.grafana.datasource:
datasource: "{{ lookup('ansible.builtin.file', 'datasource.json') }}"
stack_slug: "{{ stack_slug }}"
grafana_api_key: "{{ grafana_api_key }}"
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Dict object containing Data source information Returned: On success |
|
The response body content for the data source configuration. Returned: state is present and on success |
|
The ID assigned to the data source Returned: on success |
|
The message returned after the operation on the Data source Returned: on success |
|
The name of the data source defined in the JSON source code Returned: state is present and on success |