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

Commit fc2c9f0

Browse files
authored
Merge pull request #92 from cloudalchemy/resolve_77
[patch] Use curl instead of get_url to download dashboards
2 parents 7299282 + d99c26a commit fc2c9f0

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

tasks/dashboards.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,38 @@
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"
32+
warn: false
1633
register: _download_dashboards
1734
until: _download_dashboards is succeeded
1835
retries: 5
1936
delay: 2
2037
delegate_to: localhost
2138
run_once: true
22-
changed_when: false
2339
with_items: "{{ grafana_dashboards }}"
2440
when: grafana_dashboards | length > 0
41+
tags:
42+
- skip_ansible_lint
2543

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

0 commit comments

Comments
 (0)