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

Commit d1b9704

Browse files
authored
Use curl instead of get_url to download dashboards
1 parent 69d16c5 commit d1b9704

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

tasks/dashboards.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@
88
delegate_to: localhost
99
run_once: true
1010

11-
- name: download grafana dashboard from grafana.net to local folder
11+
# - name: download grafana dashboard from grafana.net to local folder
12+
# become: false
13+
# get_url:
14+
# url: "https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download"
15+
# dest: "/tmp/dashboards/{{ item.dashboard_id }}.json"
16+
# register: _download_dashboards
17+
# until: _download_dashboards is succeeded
18+
# retries: 5
19+
# delay: 2
20+
# delegate_to: localhost
21+
# run_once: true
22+
# changed_when: false
23+
# with_items: "{{ grafana_dashboards }}"
24+
# when: grafana_dashboards | length > 0
25+
26+
# Use curl to solve issue #77
27+
- name: download grafana dashboard from grafana.net to local directory
1228
become: false
13-
get_url:
14-
url: "https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download"
15-
dest: "/tmp/dashboards/{{ item.dashboard_id }}.json"
29+
command: "curl --compressed https://grafana.com/api/dashboards/{{ item.dashboard_id }}/revisions/{{ item.revision_id }}/download -o /tmp/dashboards/{{ item.dashboard_id }}.json"
30+
args:
31+
creates: "/tmp/dashboards/{{ item.dashboard_id }}.json"
1632
register: _download_dashboards
1733
until: _download_dashboards is succeeded
1834
retries: 5

0 commit comments

Comments
 (0)