Debian Codegraph @

ansible_collections/community/grafana/tests/integration/targets/grafana_datasource/tasks/cloudwatch.yml

raw
1 ---
2 - name: Create cloudwatch datasource
3 register: result
4 community.grafana.grafana_datasource:
5 name: datasource-cloudwatch
6 org_id: "1"
7 ds_type: cloudwatch
8 ds_url: http://monitoring.us-west-1.amazonaws.com
9 aws_auth_type: keys
10 aws_default_region: us-west-1
11 aws_access_key: speakFriendAndEnter
12 aws_secret_key: mel10n
13 aws_custom_metrics_namespaces: n1,n2
14
15 - ansible.builtin.debug:
16 var: result
17
18 - ansible.builtin.assert:
19 that:
20 - result.changed
21 - result.msg == 'Datasource datasource-cloudwatch created'
22 - result.datasource.access == 'proxy'
23 - result.datasource.basicAuth == false
24 - result.datasource.database == ''
25 - result.datasource.isDefault == false
26 - result.datasource.jsonData.authType == 'keys'
27 - result.datasource.jsonData.customMetricsNamespaces == 'n1,n2'
28 - result.datasource.jsonData.defaultRegion == 'us-west-1'
29 - result.datasource.jsonData.tlsAuth == false
30 - result.datasource.jsonData.tlsAuthWithCACert == false
31 - result.datasource.name == 'datasource-cloudwatch'
32 - result.datasource.orgId == 1
33 - ('password' not in result.datasource) or (result.datasource.password == '')
34 - result.datasource.type == 'cloudwatch'
35 - result.datasource.url == 'http://monitoring.us-west-1.amazonaws.com'
36 - result.datasource.user == ''
37 - result.datasource.withCredentials == false
38
39 - name: Check cloudwatch datasource creation idempotency
40 register: result
41 community.grafana.grafana_datasource:
42 name: datasource-cloudwatch
43 org_id: "1"
44 ds_type: cloudwatch
45 ds_url: http://monitoring.us-west-1.amazonaws.com
46 aws_auth_type: keys
47 aws_default_region: us-west-1
48 aws_access_key: speakFriendAndEnter
49 aws_secret_key: mel10n
50 aws_custom_metrics_namespaces: n1,n2
51
52 - ansible.builtin.debug:
53 var: result
54
55 - ansible.builtin.assert:
56 that:
57 - not result.changed
58 - result.datasource.access == 'proxy'
59 - result.datasource.basicAuth == false
60 - result.datasource.database == ''
61 - result.datasource.isDefault == false
62 - result.datasource.jsonData.authType == 'keys'
63 - result.datasource.jsonData.customMetricsNamespaces == 'n1,n2'
64 - result.datasource.jsonData.defaultRegion == 'us-west-1'
65 - result.datasource.jsonData.tlsAuth == false
66 - result.datasource.jsonData.tlsAuthWithCACert == false
67 - result.datasource.name == 'datasource-cloudwatch'
68 - result.datasource.orgId == 1
69 - ('password' not in result.datasource) or (result.datasource.password == '')
70 - result.datasource.type == 'cloudwatch'
71 - result.datasource.url == 'http://monitoring.us-west-1.amazonaws.com'
72 - result.datasource.user == ''
73 - result.datasource.withCredentials == false
74
75 - name: Delete cloudwatch datasource
76 register: result
77 community.grafana.grafana_datasource:
78 name: datasource-cloudwatch
79 state: absent
80
81 - ansible.builtin.debug:
82 var: result
83
84 - ansible.builtin.assert:
85 that:
86 - result.changed
87 - result.msg == 'Datasource datasource-cloudwatch deleted.'
88
89 - name: Delete cloudwatch datasource (idempotency)
90 register: result
91 community.grafana.grafana_datasource:
92 name: datasource-cloudwatch
93 state: absent
94
95 - ansible.builtin.debug:
96 var: result
97
98 - ansible.builtin.assert:
99 that:
100 - not result.changed