Debian Codegraph @

ansible_collections/community/grafana/tests/integration/targets/grafana_dashboard/tasks/dashboard-from-file-export.yml

raw symbols SCIP
1 ---
2 - name: Create Dashboard from file | Copy dashboard file
3 ansible.builtin.copy:
4 src: files/dashboard.json
5 dest: /tmp/dashboard.json
6
7 - name: Create Dashboard from file | check mode | dashboard does not exist
8 community.grafana.grafana_dashboard:
9 state: present
10 commit_message: Updated by ansible
11 path: /tmp/dashboard.json
12 overwrite: true
13 check_mode: true
14 register: dff_result1
15 - ansible.builtin.assert:
16 that:
17 - dff_result1.failed == false
18 - dff_result1.changed == true
19 - dff_result1.uid is not defined
20 - dff_result1.msg == 'Dashboard test will be created'
21
22 - name: Create Dashboard from file | run mode | dashboard does not exist
23 community.grafana.grafana_dashboard:
24 state: present
25 commit_message: Updated by ansible
26 path: /tmp/dashboard.json
27 overwrite: true
28 check_mode: false
29 register: dff_result2
30 - ansible.builtin.assert:
31 that:
32 - dff_result2.failed == false
33 - dff_result2.changed == true
34 - dff_result2.uid is defined
35 - dff_result2.uid is string
36 - dff_result2.msg == 'Dashboard test created'
37
38 - name: Create Dashboard from file | check mode | dashboard exists
39 community.grafana.grafana_dashboard:
40 state: present
41 commit_message: Updated by ansible
42 path: /tmp/dashboard.json
43 overwrite: true
44 check_mode: true
45 register: dff_result3
46 - ansible.builtin.assert:
47 that:
48 - dff_result3.failed == false
49 - dff_result3.changed == false
50 - dff_result3.uid is defined
51 - dff_result3.uid is string
52 - dff_result3.msg == 'Dashboard test unchanged.'
53
54 - name: Create Dashboard from file | run mode | dashboard exists
55 community.grafana.grafana_dashboard:
56 state: present
57 commit_message: Updated by ansible
58 path: /tmp/dashboard.json
59 overwrite: true
60 check_mode: false
61 register: dff_result4
62 - ansible.builtin.assert:
63 that:
64 - dff_result4.failed == false
65 - dff_result4.changed == false
66 - dff_result4.uid is defined
67 - dff_result4.uid is string
68 - dff_result4.msg == 'Dashboard test unchanged.'
69
70 - ansible.builtin.include_tasks:
71 file: dashboard-export.yml
72 vars:
73 uid_to_export: '{{ dff_result4.uid }}'
74
75 - ansible.builtin.include_tasks:
76 file: delete-dashboard.yml
77 vars:
78 uid_to_delete: '{{ dff_result4.uid }}'