|
1 | 1 | --- |
2 | 2 | # Ingest data generated by gen_synth_loki_data.yml to Loki |
3 | 3 |
|
4 | | -- name: "Ingest data log to Loki via API" |
| 4 | +- name: "TEST Push data to Loki {{ scenario_name }}" |
5 | 5 | block: |
6 | | - |
7 | | - - name: "Push data to Loki" |
| 6 | + - name: "POST data to Loki" |
8 | 7 | ansible.builtin.uri: |
9 | | - ## loki_push_url will be used in future role developement |
| 8 | + # loki_push_url is configured in setup_loki_env.yml |
10 | 9 | url: "{{ loki_push_url }}" |
11 | 10 | method: POST |
12 | 11 | src: "{{ cloudkitty_data_file }}" |
13 | 12 | body_format: json |
14 | 13 | client_cert: "{{ cert_dir }}/tls.crt" |
15 | 14 | client_key: "{{ cert_dir }}/tls.key" |
| 15 | + # Note: ca_path not required with validate_certs: false, but included for consistency with retrieve_loki_data.yml |
| 16 | + ca_path: "{{ cert_dir }}/ca.crt" |
16 | 17 | validate_certs: false |
17 | 18 | status_code: 204 |
18 | 19 | return_content: true |
19 | 20 | register: loki_response |
20 | | - ignore_errors: false |
21 | | - failed_when: loki_response.status != 204 |
22 | 21 |
|
23 | | - # Success |
24 | | - - name: "Confirm ingestion success" |
| 22 | + - name: "Ingest Status Message" |
25 | 23 | ansible.builtin.debug: |
26 | | - msg: "Ingestion Successful!" |
| 24 | + msg: "Ingestion Successful for {{ scenario_name }}" |
27 | 25 |
|
28 | 26 | rescue: |
29 | | - # Rescue block |
30 | | - - name: "Debug failure" |
31 | | - ansible.builtin.debug: |
32 | | - msg: "Ingest failed. Loki Status: {{ loki_response.status | default('N/A') }}" |
| 27 | + - name: "IngestionFailed" |
| 28 | + ansible.builtin.fail: |
| 29 | + msg: |
| 30 | + - "Scenario: {{ scenario_name }}" |
| 31 | + - "Status: {{ loki_response.status | default('Unknown') }}" |
| 32 | + - "Body: {{ loki_response.content | default('No Content') }}" |
| 33 | + - "Message: {{ loki_response.msg | default('Request failed') }}" |
0 commit comments