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

Commit

Permalink
Merge pull request #92 from cloudalchemy/resolve_77
Browse files Browse the repository at this point in the history
[patch] Use curl instead of get_url to download dashboards
  • Loading branch information
paulfantom committed Aug 24, 2018
2 parents 7299282 + d99c26a commit fc2c9f0
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions tasks/dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,38 @@
delegate_to: localhost
run_once: true

- name: download grafana dashboard from grafana.net to local folder
# - name: download grafana dashboard from grafana.net to local folder
# become: false
# get_url:
# url: "https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download"
# dest: "/tmp/dashboards/{{ item.dashboard_id }}.json"
# register: _download_dashboards
# until: _download_dashboards is succeeded
# retries: 5
# delay: 2
# delegate_to: localhost
# run_once: true
# changed_when: false
# with_items: "{{ grafana_dashboards }}"
# when: grafana_dashboards | length > 0

# Use curl to solve issue #77
- name: download grafana dashboard from grafana.net to local directory
become: false
get_url:
url: "https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download"
dest: "/tmp/dashboards/{{ item.dashboard_id }}.json"
command: "curl --compressed https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download -o /tmp/dashboards/{{ item.dashboard_id }}.json"
args:
creates: "/tmp/dashboards/{{ item.dashboard_id }}.json"
warn: false
register: _download_dashboards
until: _download_dashboards is succeeded
retries: 5
delay: 2
delegate_to: localhost
run_once: true
changed_when: false
with_items: "{{ grafana_dashboards }}"
when: grafana_dashboards | length > 0
tags:
- skip_ansible_lint

# As noted in [1] an exported dashboard replaces the exporter's datasource
# name with a representative name, something like 'DS_GRAPHITE'. The name
Expand Down

0 comments on commit fc2c9f0

Please sign in to comment.