From 9025f7fb20830b34c36b1c0c337a5c791048749b Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 10 Jan 2024 18:58:12 +0100 Subject: [PATCH] Option to auto assign a default role. --- defaults/main.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b1776ff..00238c0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -10,6 +10,8 @@ grafana_pkg_state: present grafana_packages: - grafana +grafana_oauth_auto_assign_role: false +grafana_role_attribute_strict: "{% if grafana_oauth_auto_assign_role %}false{% else %}true{% endif %}" grafana_conf: - { section: "", option: app_mode, value: "{{ grafana_app_mode }}", state: present } - { section: "", option: instance_name, value: "{{ grafana_instance_name }}", state: present } @@ -70,7 +72,11 @@ grafana_conf: option: auto_assign_org value: "{{ grafana_u_auto_assign_org | default(true) | lower }}" state: present - - { section: users, option: auto_assign_org_role, value: "{{grafana_u_default_role | lower }}", state: present } + - { section: users, option: auto_assign_org_role, value: "{{ grafana_u_default_role | lower }}", state: "{% if grafana_oauth_auto_assign_role %}present{% else %}absent{% endif %}" } + - section: users + option: role_attribute_strict + value: "{{ grafana_role_attribute_strict }}" + state: "present" - { section: users, option: default_theme, value: "{{ grafana_u_default_theme }}", state: present } - { section: auth, option: disable_login_form, value: "{{ grafana_u_disable_login_form | lower }}", state: present } - { section: auth, option: oauth_auto_login, value: "{{ grafana_oauth_auto_login | lower }}", state: present } @@ -170,7 +176,6 @@ grafana_conf: - { section: remote_cache, option: type, value: "{{ grafana_remote_cache }}", state: present } - { section: remote_cache, option: connstr, value: "{{ grafana_remote_cache_connstr }}", state: present } - grafana_additional_conf: [] grafana_ldap_conf_file: - ldap.toml