b8979c2083
The grafana local admin username can be configured by overriding the admin user field in the grafana.ini file. However, this will fail when kolla-ansible attempts to configure any enabled datasources for grafana because the local admin password is hardcoded to 'admin'. This change allows the grafana local admin password to be configured via group vars so that the correct username is used when configuring datasources. Closes-Bug: #1750408 Change-Id: I0962200894f7a0452da1c249a68f9230b6fab13f
42 lines
1.4 KiB
YAML
42 lines
1.4 KiB
YAML
---
|
|
- name: Wait for grafana application ready
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/login"
|
|
status_code: 200
|
|
register: result
|
|
until: result.get('status') == 200
|
|
retries: 10
|
|
delay: 2
|
|
run_once: true
|
|
|
|
- name: Enable grafana datasources
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/api/datasources"
|
|
method: POST
|
|
user: "{{ grafana_admin_username }}"
|
|
password: "{{ grafana_admin_password }}"
|
|
body: "{{ item.value.data | to_json }}"
|
|
body_format: json
|
|
force_basic_auth: yes
|
|
status_code: 200, 409
|
|
register: response
|
|
run_once: True
|
|
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(""))
|
|
with_dict: "{{ grafana_data_sources }}"
|
|
when: item.value.enabled | bool
|
|
|
|
- name: Disable Getting Started panel
|
|
uri:
|
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/api/user/helpflags/1"
|
|
method: PUT
|
|
user: "{{ grafana_admin_username }}"
|
|
password: "{{ grafana_admin_password }}"
|
|
force_basic_auth: yes
|
|
status_code: 200
|
|
register: grafana_response
|
|
changed_when: grafana_response.status == 200
|
|
run_once: true
|
|
when: grafana_custom_dashboard_file.stat.exists
|