Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Enable jsonData in grafana_datasources #100

Closed
alrosot opened this issue Sep 18, 2018 · 4 comments
Closed

Enable jsonData in grafana_datasources #100

alrosot opened this issue Sep 18, 2018 · 4 comments

Comments

@alrosot
Copy link

alrosot commented Sep 18, 2018

Hello,

The file datasources.yml is not considering jsonData property (documented at http://docs.grafana.org/administration/provisioning/)

That is not a problem when you are setting up datasources like prometheus. However it becomes a blocker if you ever try to add a cloudwatch datasource like the one below:

apiVersion: 1

datasources:
- name: cloudwatch
  type: cloudwatch
  jsonData:
    authType: arn
    defaultRegion: ap-southeast-2

Thank you!

@paulfantom
Copy link
Member

It is possible to do this now, look at this task:

- name: Create/Update datasources file (provisioning)
copy:
dest: "/etc/grafana/provisioning/datasources/ansible.yml"
content: |
apiVersion: 1
deleteDatasources: []
datasources:
{{ grafana_datasources | to_nice_yaml }}
backup: false
owner: root
group: grafana
mode: 0640
become: true
notify: restart grafana
when: grafana_use_provisioning

@paulfantom
Copy link
Member

In defaults/main.yml there is also an example of how to use it:

grafana_datasources: []
# - name: "Prometheus"
# type: "prometheus"
# access: "proxy"
# url: "http://prometheus.mydomain"
# basicAuth: true
# basicAuthUser: "admin"
# basicAuthPassword: "password"
# isDefault: true
# jsonData:
# tlsAuth: false
# tlsAuthWithCACert: false
# tlsSkipVerify: true

Closing since this is already implemented. @alrosot feel free to reopen if you need more help with configuring that.

@alrosot
Copy link
Author

alrosot commented Oct 1, 2018

That was perfect, Paweł . Thanks for the help!

@lock
Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants