| 1 |
--- |
| 2 |
- name: Create Quickwit datasource |
| 3 |
register: result |
| 4 |
community.grafana.grafana_datasource: |
| 5 |
name: Quickwit |
| 6 |
org_id: "1" |
| 7 |
ds_type: quickwit-quickwit-datasource |
| 8 |
ds_url: http://localhost:7280/api/v1 |
| 9 |
additional_json_data: |
| 10 |
index: hdfs-logs |
| 11 |
timeField: timestamp |
| 12 |
timeOutputFormat: unix_timestamp_secs |
| 13 |
logMessageField: body |
| 14 |
logLevelField: severity_text |
| 15 |
|
| 16 |
- ansible.builtin.debug: |
| 17 |
var: result |
| 18 |
|
| 19 |
- ansible.builtin.assert: |
| 20 |
that: |
| 21 |
- result.changed |
| 22 |
- result.datasource.access == 'proxy' |
| 23 |
- not result.datasource.isDefault |
| 24 |
- result.datasource.database == '' |
| 25 |
- result.datasource.name == 'Quickwit' |
| 26 |
- result.datasource.orgId == 1 |
| 27 |
- result.datasource.type == 'quickwit-quickwit-datasource' |
| 28 |
- result.datasource.url == 'http://localhost:7280/api/v1' |
| 29 |
- result.msg == 'Datasource Quickwit created' |
| 30 |
- result.datasource.jsonData.index == 'hdfs-logs' |
| 31 |
- result.datasource.jsonData.timeField == 'timestamp' |
| 32 |
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_secs' |
| 33 |
- result.datasource.jsonData.logMessageField == 'body' |
| 34 |
- result.datasource.jsonData.logLevelField == 'severity_text' |
| 35 |
|
| 36 |
- name: Check Quickwit datasource creation (idempotency) |
| 37 |
register: result |
| 38 |
community.grafana.grafana_datasource: |
| 39 |
name: Quickwit |
| 40 |
org_id: "1" |
| 41 |
ds_type: quickwit-quickwit-datasource |
| 42 |
ds_url: http://localhost:7280/api/v1 |
| 43 |
additional_json_data: |
| 44 |
index: hdfs-logs |
| 45 |
timeField: timestamp |
| 46 |
timeOutputFormat: unix_timestamp_secs |
| 47 |
logMessageField: body |
| 48 |
logLevelField: severity_text |
| 49 |
|
| 50 |
- ansible.builtin.debug: |
| 51 |
var: result |
| 52 |
|
| 53 |
- ansible.builtin.assert: |
| 54 |
that: |
| 55 |
- not result.changed |
| 56 |
- result.datasource.access == 'proxy' |
| 57 |
- not result.datasource.isDefault |
| 58 |
- result.datasource.database == '' |
| 59 |
- result.datasource.name == 'Quickwit' |
| 60 |
- result.datasource.orgId == 1 |
| 61 |
- result.datasource.type == 'quickwit-quickwit-datasource' |
| 62 |
- result.datasource.url == 'http://localhost:7280/api/v1' |
| 63 |
- result.msg == 'Datasource Quickwit created' |
| 64 |
- result.datasource.jsonData.index == 'hdfs-logs' |
| 65 |
- result.datasource.jsonData.timeField == 'timestamp' |
| 66 |
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_secs' |
| 67 |
- result.datasource.jsonData.logMessageField == 'body' |
| 68 |
- result.datasource.jsonData.logLevelField == 'severity_text' |
| 69 |
|
| 70 |
- name: Update Quickwit datasource |
| 71 |
register: result |
| 72 |
community.grafana.grafana_datasource: |
| 73 |
name: Quickwit |
| 74 |
org_id: "1" |
| 75 |
ds_type: quickwit-quickwit-datasource |
| 76 |
ds_url: http://quickwit-url:7280/api/v1 |
| 77 |
additional_json_data: |
| 78 |
index: hdfs-logs |
| 79 |
timeField: timestamp |
| 80 |
timeOutputFormat: unix_timestamp_millis |
| 81 |
logMessageField: body |
| 82 |
logLevelField: severity_text |
| 83 |
|
| 84 |
- ansible.builtin.debug: |
| 85 |
var: result |
| 86 |
|
| 87 |
- ansible.builtin.assert: |
| 88 |
that: |
| 89 |
- result.changed |
| 90 |
- result.datasource.access == 'proxy' |
| 91 |
- not result.datasource.isDefault |
| 92 |
- result.datasource.database == '' |
| 93 |
- result.datasource.name == 'Quickwit' |
| 94 |
- result.datasource.orgId == 1 |
| 95 |
- result.datasource.type == 'quickwit-quickwit-datasource' |
| 96 |
- result.datasource.url == 'http://quickwit-url:7280/api/v1' |
| 97 |
- result.msg == 'Datasource Quickwit created' |
| 98 |
- result.datasource.jsonData.index == 'hdfs-logs' |
| 99 |
- result.datasource.jsonData.timeField == 'timestamp' |
| 100 |
- result.datasource.jsonData.timeOutputFormat == 'unix_timestamp_millis' |
| 101 |
- result.datasource.jsonData.logMessageField == 'body' |
| 102 |
- result.datasource.jsonData.logLevelField == 'severity_text' |
| 103 |
|
| 104 |
- name: Delete Quickwit datasource |
| 105 |
register: result |
| 106 |
community.grafana.grafana_datasource: |
| 107 |
name: Quickwit |
| 108 |
state: absent |
| 109 |
|
| 110 |
- ansible.builtin.assert: |
| 111 |
that: |
| 112 |
- result.changed |
| 113 |
|
| 114 |
- name: Delete Quickwit datasource (idempotency) |
| 115 |
register: result |
| 116 |
community.grafana.grafana_datasource: |
| 117 |
name: Quickwit |
| 118 |
state: absent |
| 119 |
|
| 120 |
- ansible.builtin.assert: |
| 121 |
that: |
| 122 |
- not result.changed |