diff --git a/defaults/main.yml b/defaults/main.yml index 4c3ac73..aad24b6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -86,7 +86,8 @@ grafana_auth: {} # ldap: # config_file: "/etc/grafana/ldap.toml" # allow_sign_up: false -# basic: true +# basic: +# enabled: true grafana_ldap: {} # verbose_logging: false diff --git a/molecule/alternative/playbook.yml b/molecule/alternative/playbook.yml index 7645faf..7731141 100644 --- a/molecule/alternative/playbook.yml +++ b/molecule/alternative/playbook.yml @@ -19,7 +19,8 @@ ldap: config_file: "/etc/grafana/ldap.toml" allow_sign_up: false - basic: true + basic: + enabled: true grafana_ldap: verbose_logging: false servers: diff --git a/templates/grafana.ini.j2 b/templates/grafana.ini.j2 index ff87158..4c779f8 100644 --- a/templates/grafana.ini.j2 +++ b/templates/grafana.ini.j2 @@ -58,15 +58,13 @@ disable_login_form = {{ grafana_auth.disable_login_form | default('False') }} disable_signout_menu = {{ grafana_auth.disable_signout_menu | default('False') }} {% for section, options in grafana_auth.items() %} {% if section in ['disable_login_form', 'disable_signout_menu'] %} -{% elif section == 'basic' %} -[auth.basic] -enabled = True {% else %} [auth.{{ section }}] +{% if "enabled" not in options %} enabled = True +{% endif %} {% for k, v in options.items() %} -{% if k != 'enabled' %}{{ k }} = {{ v }} -{% endif %} +{{ k }} = {{ v }} {% endfor %} {% endif %} {% endfor %}