Support configuring grafana local admin username

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
This commit is contained in:
Doug Szumski 2018-02-19 16:15:48 +00:00
parent 96ede1eb55
commit b8979c2083
3 changed files with 4 additions and 3 deletions

View File

@ -52,3 +52,4 @@ grafana_data_sources:
grafana_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-grafana"
grafana_tag: "{{ openstack_release }}"
grafana_image_full: "{{ grafana_image }}:{{ grafana_tag }}"
grafana_admin_username: "admin"

View File

@ -13,7 +13,7 @@
uri:
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/api/datasources"
method: POST
user: admin
user: "{{ grafana_admin_username }}"
password: "{{ grafana_admin_password }}"
body: "{{ item.value.data | to_json }}"
body_format: json
@ -31,7 +31,7 @@
uri:
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ grafana_server_port }}/api/user/helpflags/1"
method: PUT
user: admin
user: "{{ grafana_admin_username }}"
password: "{{ grafana_admin_password }}"
force_basic_auth: yes
status_code: 200

View File

@ -35,5 +35,5 @@ reporting_enabled = false
check_for_updates = false
[security]
admin_user = admin
admin_user = {{ grafana_admin_username }}
admin_password = {{ grafana_admin_password }}