49c083f555
Sometimes the "Enable influxdb datasource" task failed with "503 Service Unavailable" error. Waiting for grafana port UP seems not always enough, it requires to wait for application ready. Change-Id: I3a27b3086698b89a80a3f585beb810831289ae7a Closes-Bug: #1697213
30 lines
954 B
YAML
30 lines
954 B
YAML
---
|
|
- name: Wait for grafana application ready
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}"
|
|
status_code: 200
|
|
register: result
|
|
until: result.status == 200
|
|
retries: 10
|
|
delay: 2
|
|
run_once: true
|
|
connection: local
|
|
|
|
- name: Enable influxdb datasource
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/api/datasources"
|
|
method: POST
|
|
user: admin
|
|
password: "{{ grafana_admin_password }}"
|
|
body: "{{ grafana_data_source | to_json }}"
|
|
body_format: json
|
|
force_basic_auth: yes
|
|
status_code: 200, 409
|
|
register: response
|
|
run_once: True
|
|
connection: local
|
|
when: grafana_data_source is defined
|
|
changed_when: response.status == 200
|
|
failed_when: response.status not in [200, 409] or
|
|
response.status == 409 and ("Data source with same name already exists" not in response.json.message|default(""))
|