
In order to automate Grafana configuration, this fix automatically set the InfluxDB datasource. This avoid doing a annoying manual configuration after Kolla-ansible deployment. Change-Id: I2b1a63fd371966192f1df0a82cee4711c6324710
22 lines
754 B
YAML
22 lines
754 B
YAML
---
|
|
- name: Wait for grafana port
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ grafana_server_port }}"
|
|
|
|
- name: Enable influxdb datasource
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ api_interface_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
|
|
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(""))
|