Lint refactoring

This commit is contained in:
Andrea Dell'Amico 2022-12-20 17:39:58 +01:00
parent c6e41dd156
commit 3d94f7f81e
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
6 changed files with 216 additions and 149 deletions

View File

@ -1,88 +1,162 @@
--- ---
grafana_repo_key: https://packages.grafana.com/gpg.key grafana_repo_key: https://packages.grafana.com/gpg.key
grafana_repo: 'deb https://packages.grafana.com/oss/deb stable main' grafana_repo: deb https://packages.grafana.com/oss/deb stable main
grafana_pkg_state: latest grafana_pkg_state: latest
grafana_packages: grafana_packages:
- grafana - grafana
grafana_conf: grafana_conf:
- {section: '', option: 'app_mode', value: '{{ grafana_app_mode }}', state: present} - { section: "", option: app_mode, value: "{{ grafana_app_mode }}", state: present }
- {section: '', option: 'instance_name', value: '{{ grafana_instance_name }}', state: present} - { section: "", option: instance_name, value: "{{ grafana_instance_name }}", state: present }
- {section: 'paths', option: 'data', value: '{{ grafana_data_path }}', state: present} - { section: paths, option: data, value: "{{ grafana_data_path }}", state: present }
- {section: 'server', option: 'protocol', value: '{{ grafana_server_protocol }}', state: present} - { section: server, option: protocol, value: "{{ grafana_server_protocol }}", state: present }
- {section: 'server', option: 'http_addr', value: '{{ grafana_bind_ip_address }}', state: present} - { section: server, option: http_addr, value: "{{ grafana_bind_ip_address }}", state: present }
- {section: 'server', option: 'http_port', value: '{{ grafana_http_port }}', state: present} - { section: server, option: http_port, value: "{{ grafana_http_port }}", state: present }
- {section: 'server', option: 'domain', value: '{{ grafana_domain_name }}', state: present} - { section: server, option: domain, value: "{{ grafana_domain_name }}", state: present }
- {section: 'server', option: 'enforce_domain', value: '{{ grafana_enforce_dom_name | lower }}', state: present} - { section: server, option: enforce_domain, value: "{{ grafana_enforce_dom_name | lower }}", state: present }
- {section: 'server', option: 'root_url', value: "{{ grafana_public_endpoint | default('%(protocol)s://%(domain)s:%(http_port)s/') }}", state: present} - section: server
- {section: 'database', option: 'type', value: '{{ grafana_db_type }}', state: present} option: root_url
- {section: 'database', option: 'host', value: '{{ grafana_db_hostport }}', state: present} value: "{{ grafana_public_endpoint | default('%(protocol)s://%(domain)s:%(http_port)s/') }}"
- {section: 'database', option: 'name', value: '{{ grafana_db_name }}', state: present} state: present
- {section: 'database', option: 'user', value: '{{ grafana_db_user }}', state: present} - { section: database, option: type, value: "{{ grafana_db_type }}", state: present }
- {section: 'database', option: 'password', value: '{{ grafana_db_password }}', state: present} - { section: database, option: host, value: "{{ grafana_db_hostport }}", state: present }
- {section: 'database', option: 'ssl_mode', value: '{{ grafana_db_pg_ssl_mode }}', state: present} - { section: database, option: name, value: "{{ grafana_db_name }}", state: present }
- {section: 'session', option: 'provider', value: '{{ grafana_session_provider }}', state: present} - { section: database, option: user, value: "{{ grafana_db_user }}", state: present }
- {section: 'session', option: 'provider_config', value: '{{ grafana_session_config }}', state: present} - { section: database, option: password, value: "{{ grafana_db_password }}", state: present }
- {section: 'session', option: 'secure_cookie', value: '{{ grafana_secure_cookies | lower }}', state: present} - { section: database, option: ssl_mode, value: "{{ grafana_db_pg_ssl_mode }}", state: present }
- {section: 'session', option: 'cookie_name', value: '{{ grafana_cookie_name }}', state: present} - { section: session, option: provider, value: "{{ grafana_session_provider }}", state: present }
- {section: 'analytics', option: 'reporting_enabled', value: '{{ grafana_analytics_reporting_enabled | lower }}', state: present} - { section: session, option: provider_config, value: "{{ grafana_session_config }}", state: present }
- {section: 'analytics', option: 'check_for_updates', value: '{{ grafana_analytics_updates_check | lower }}', state: present} - { section: session, option: secure_cookie, value: "{{ grafana_secure_cookies | lower }}", state: present }
- {section: 'security', option: 'admin_user', value: '{{ grafana_admin_user }}', state: "{% if grafana_setup_admin_user %}present{% else %}absent{% endif %}"} - { section: session, option: cookie_name, value: "{{ grafana_cookie_name }}", state: present }
- {section: 'security', option: 'admin_password', value: '{{ grafana_admin_password }}', state: "{% if grafana_setup_admin_user %}present{% else %}absent{% endif %}"} - section: analytics
- {section: 'security', option: 'secret_key', value: '{{grafana_signing_key }}', state: "{% if grafana_setup_signing_key %}present{% else %}absent{% endif %}"} option: reporting_enabled
- {section: 'security', option: 'cookie_secure', value: '{{ grafana_secure_cookies | lower }}', state: present} value: "{{ grafana_analytics_reporting_enabled | lower }}"
- {section: 'security', option: 'cookie_samesite', value: "{{ grafana_cookie_samesite | default('lax') }}", state: present} state: present
- {section: 'security', option: 'allow_embedding', value: "{{ grafana_allow_embedding | default(false) | lower }}", state: present} - { section: analytics, option: check_for_updates, value: "{{ grafana_analytics_updates_check | lower }}", state: present }
- {section: 'dashboards', option: 'versions_to_keep', value: "{{ grafana_dashboards_versions_to_keep | default('20') }}", state: present} - section: security
- {section: 'dashboards', option: 'min_refresh_interval', value: "{{ grafana_dashbards_min_default_interval | default('5s') }}", state: present} option: admin_user
- {section: 'users', option: 'allow_sign_up', value: '{{ grafana_u_allow_signup | lower }}', state: present} value: "{{ grafana_admin_user }}"
- {section: 'users', option: 'allow_org_create', value: '{{ grafana_u_allow_org_create | lower }}', state: present} state: "{% if grafana_setup_admin_user %}present{% else %}absent{% endif %}"
- {section: 'users', option: 'auto_assign_org', value: "{{ grafana_u_auto_assign_org | default(true) | lower }}", state: present} - section: security
- {section: 'users', option: 'auto_assign_org_role', value: "{{grafana_u_default_role | lower }}", state: present} option: admin_password
- {section: 'users', option: 'default_theme', value: '{{ grafana_u_default_theme }}', state: present} value: "{{ grafana_admin_password }}"
- {section: 'auth', option: 'disable_login_form', value: '{{ grafana_u_disable_login_form | lower }}', state: present} state: "{% if grafana_setup_admin_user %}present{% else %}absent{% endif %}"
- {section: 'auth', option: 'oauth_auto_login', value: '{{ grafana_oauth_auto_login | lower }}', state: present} - section: security
- {section: 'auth.anonymous', option: 'enabled', value: '{{ grafana_auth_anon | lower }}', state: present} option: secret_key
- {section: 'auth.generic_oauth', option: 'enabled', value: '{{ grafana_oauth_generic_enabled | lower }}', state: present} value: "{{grafana_signing_key }}"
- {section: 'auth.generic_oauth', option: 'name', value: '{{ grafana_oauth_name }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} state: "{% if grafana_setup_signing_key %}present{% else %}absent{% endif %}"
- {section: 'auth.generic_oauth', option: 'icon', value: 'signin', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} - { section: security, option: cookie_secure, value: "{{ grafana_secure_cookies | lower }}", state: present }
- {section: 'auth.generic_oauth', option: 'scopes', value: '{{ grafana_oauth_scopes }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} - { section: security, option: cookie_samesite, value: "{{ grafana_cookie_samesite | default('lax') }}", state: present }
- {section: 'auth.generic_oauth', option: 'empty_scopes', value: '{{ grafana_oauth_empty_scopes | lower }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} - section: security
- {section: 'auth.generic_oauth', option: 'tls_skip_verify_insecure', value: '{{ grafana_tls_skip_verify_insecure | lower }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} option: allow_embedding
- {section: 'auth.generic_oauth', option: 'allow_sign_up', value: '{{ grafana_oauth_allow_signup | lower }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} value: "{{ grafana_allow_embedding | default(false) | lower }}"
- {section: 'auth.generic_oauth', option: 'client_id', value: "{{ grafana_oauth_client_id | default('grafana') }}", state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} state: present
- {section: 'auth.generic_oauth', option: 'client_secret', value: '{{ grafana_oauth_client_secret }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} - section: dashboards
- {section: 'auth.generic_oauth', option: 'auth_url', value: '{{ grafana_oauth_auth_url }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} option: versions_to_keep
- {section: 'auth.generic_oauth', option: 'token_url', value: "{{ grafana_oauth_token_url | default('') }}", state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} value: "{{ grafana_dashboards_versions_to_keep | default('20') }}"
- {section: 'auth.generic_oauth', option: 'api_url', value: '{{grafana_oauth_api_url }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} state: present
- {section: 'auth.generic_oauth', option: 'use_pkce', value: '{{ grafana_oauth_use_pkce | lower }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} - section: dashboards
- {section: 'auth.generic_oauth', option: 'auth_style', value: "{{ grafana_oauth_auth_style | default('') }}", state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} option: min_refresh_interval
- {section: 'auth.generic_oauth', option: 'allow_assign_grafana_admin', value: '{{ grafana_oauth_allow_assign_grafana_admin | lower }}', state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} value: "{{ grafana_dashbards_min_default_interval | default('5s') }}"
- {section: 'auth.generic_oauth', option: 'role_attribute_path', value: "{{ grafana_oauth_role_attribute_path }}", state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"} state: present
- {section: 'auth.ldap', option: 'enabled', value: '{{grafana_ldap_auth | lower }}', state: present} - { section: users, option: allow_sign_up, value: "{{ grafana_u_allow_signup | lower }}", state: present }
- {section: 'auth.ldap', option: 'config_file', value: '/etc/grafana/ldap.toml', state: present} - { section: users, option: allow_org_create, value: "{{ grafana_u_allow_org_create | lower }}", state: present }
- {section: 'log', option: 'mode', value: '{{ grafana_log_mode }}', state: present} - section: users
- {section: 'log', option: 'level', value: '{{ grafana_log_level }}', state: present} option: auto_assign_org
- {section: 'log.console', option: 'level', value: '{{ grafana_log_level }}', state: present} value: "{{ grafana_u_auto_assign_org | default(true) | lower }}"
- {section: 'log.console', option: 'format', value: "{{ grafana_log_console_format | default('text') }}", state: present} state: present
- {section: 'log.syslog', option: 'level', value: '{{ grafana_log_level }}', state: present} - { section: users, option: auto_assign_org_role, value: "{{grafana_u_default_role | lower }}", state: present }
- {section: 'log.syslog', option: 'facility', value: '{{ grafana_syslog_facility }}', state: present} - { section: users, option: default_theme, value: "{{ grafana_u_default_theme }}", state: present }
- {section: 'dashboards.json', option: 'enabled', value: '{{ grafana_dashboard_json | lower }}', state: present} - { section: auth, option: disable_login_form, value: "{{ grafana_u_disable_login_form | lower }}", state: present }
- {section: 'dashboards.json', option: 'path', value: "{{ grafana_dashboards_json_path | default('/var/lib/grafana/dashboards') }}", state: present} - { section: auth, option: oauth_auto_login, value: "{{ grafana_oauth_auto_login | lower }}", state: present }
- {section: 'metrics', option: 'enabled', value: "{{ grafana_metrics_enabled | default(true) | lower }}", state: present} - { section: auth.anonymous, option: enabled, value: "{{ grafana_auth_anon | lower }}", state: present }
- {section: 'grafana_net', option: 'url', value: 'https://grafana.net', state: present} - { section: auth.generic_oauth, option: enabled, value: "{{ grafana_oauth_generic_enabled | lower }}", state: present }
- {section: 'remote_cache', option: 'type', value: '{{ grafana_remote_cache }}', state: present} - section: auth.generic_oauth
- {section: 'remote_cache', option: 'connstr', value: '{{ grafana_remote_cache_connstr }}', state: present} option: name
value: "{{ grafana_oauth_name }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: icon
value: signin
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: scopes
value: "{{ grafana_oauth_scopes }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: empty_scopes
value: "{{ grafana_oauth_empty_scopes | lower }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: tls_skip_verify_insecure
value: "{{ grafana_tls_skip_verify_insecure | lower }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: allow_sign_up
value: "{{ grafana_oauth_allow_signup | lower }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: client_id
value: "{{ grafana_oauth_client_id | default('grafana') }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: client_secret
value: "{{ grafana_oauth_client_secret }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: auth_url
value: "{{ grafana_oauth_auth_url }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: token_url
value: "{{ grafana_oauth_token_url | default('') }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: api_url
value: "{{grafana_oauth_api_url }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: use_pkce
value: "{{ grafana_oauth_use_pkce | lower }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: auth_style
value: "{{ grafana_oauth_auth_style | default('') }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: allow_assign_grafana_admin
value: "{{ grafana_oauth_allow_assign_grafana_admin | lower }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- section: auth.generic_oauth
option: role_attribute_path
value: "{{ grafana_oauth_role_attribute_path }}"
state: "{% if grafana_oauth_generic_enabled %}present{% else %}absent{% endif %}"
- { section: auth.ldap, option: enabled, value: "{{grafana_ldap_auth | lower }}", state: present }
- { section: auth.ldap, option: config_file, value: /etc/grafana/ldap.toml, state: present }
- { section: log, option: mode, value: "{{ grafana_log_mode }}", state: present }
- { section: log, option: level, value: "{{ grafana_log_level }}", state: present }
- { section: log.console, option: level, value: "{{ grafana_log_level }}", state: present }
- { section: log.console, option: format, value: "{{ grafana_log_console_format | default('text') }}", state: present }
- { section: log.syslog, option: level, value: "{{ grafana_log_level }}", state: present }
- { section: log.syslog, option: facility, value: "{{ grafana_syslog_facility }}", state: present }
- { section: dashboards.json, option: enabled, value: "{{ grafana_dashboard_json | lower }}", state: present }
- section: dashboards.json
option: path
value: "{{ grafana_dashboards_json_path | default('/var/lib/grafana/dashboards') }}"
state: present
- { section: metrics, option: enabled, value: "{{ grafana_metrics_enabled | default(true) | lower }}", state: present }
- { section: grafana_net, option: url, value: https://grafana.net, state: present }
- { 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_additional_conf: []
grafana_ldap_conf_file: grafana_ldap_conf_file:
- ldap.toml - ldap.toml
grafana_enabled: true grafana_enabled: true
grafana_app_mode: production grafana_app_mode: production
grafana_instance_name: '{{ ansible_fqdn }}' grafana_instance_name: "{{ ansible_fqdn }}"
grafana_require_nginx: true grafana_require_nginx: true
grafana_require_redis: true grafana_require_redis: true
@ -91,13 +165,13 @@ grafana_session_provider: file
# Remote cache: "redis", "memcached" or "database" default is "database" # Remote cache: "redis", "memcached" or "database" default is "database"
grafana_remote_cache: database grafana_remote_cache: database
grafana_remote_cache_connstr: '' grafana_remote_cache_connstr: ""
grafana_data_path: /var/lib/grafana grafana_data_path: /var/lib/grafana
grafana_server_protocol: http grafana_server_protocol: http
grafana_bind_ip_address: 127.0.0.1 grafana_bind_ip_address: 127.0.0.1
grafana_http_port: 3000 grafana_http_port: 3000
grafana_domain_name: '{{ ansible_fqdn }}' grafana_domain_name: "{{ ansible_fqdn }}"
grafana_enforce_dom_name: true grafana_enforce_dom_name: true
grafana_cookie_name: grafana_sess grafana_cookie_name: grafana_sess
grafana_secure_cookies: true grafana_secure_cookies: true
@ -106,8 +180,8 @@ grafana_secure_cookies: true
grafana_db_type: sqlite3 grafana_db_type: sqlite3
# The other db data is not needed when the choice is sqlite3 # The other db data is not needed when the choice is sqlite3
grafana_db_port: 5432 grafana_db_port: 5432
grafana_db_host: '127.0.0.1' grafana_db_host: 127.0.0.1
grafana_db_hostport: '{{ grafana_db_host }}:{{ grafana_db_port }}' grafana_db_hostport: "{{ grafana_db_host }}:{{ grafana_db_port }}"
grafana_db_name: grafana grafana_db_name: grafana
grafana_db_user: grafana_u grafana_db_user: grafana_u
# grafana_db_password: 'set_it_into_a_vault_file' # grafana_db_password: 'set_it_into_a_vault_file'
@ -121,16 +195,16 @@ grafana_setup_signing_key: false
# sessions, or if redis: 'addr=127.0.0.1:6379,pool_size=100,db=grafana' # sessions, or if redis: 'addr=127.0.0.1:6379,pool_size=100,db=grafana'
grafana_session_config: sessions grafana_session_config: sessions
grafana_analytics_reporting_enabled: 'true' grafana_analytics_reporting_enabled: "true"
grafana_analytics_updates_check: 'true' grafana_analytics_updates_check: "true"
grafana_u_allow_signup: 'false' grafana_u_allow_signup: "false"
grafana_u_allow_org_create: 'false' grafana_u_allow_org_create: "false"
grafana_u_default_role: Viewer grafana_u_default_role: Viewer
# dark or light # dark or light
grafana_u_default_theme: dark grafana_u_default_theme: dark
grafana_u_disable_login_form: false grafana_u_disable_login_form: false
grafana_auth_anon: 'false' grafana_auth_anon: "false"
grafana_log_mode: syslog grafana_log_mode: syslog
grafana_log_level: info grafana_log_level: info
@ -146,36 +220,36 @@ grafana_additional_plugins:
grafana_ldap_auth: false grafana_ldap_auth: false
grafana_ldap_host: 127.0.0.1 grafana_ldap_host: 127.0.0.1
grafana_ldap_port: 636 grafana_ldap_port: 636
grafana_ldap_use_ssl: 'true' grafana_ldap_use_ssl: "true"
grafana_ldap_ssl_skip_verify: 'false' grafana_ldap_ssl_skip_verify: "false"
grafana_ldap_bind_dn: 'cn=admin,dc=grafana,dc=org' grafana_ldap_bind_dn: cn=admin,dc=grafana,dc=org
grafana_ldap_bind_pwd: 'grafana' grafana_ldap_bind_pwd: grafana
grafana_ldap_u_search_filter: '(uid=%s)' grafana_ldap_u_search_filter: (uid=%s)
grafana_ldap_u_search_base: 'dc=grafana,dc=org' grafana_ldap_u_search_base: dc=grafana,dc=org
grafana_ldap_posix_groups: 'false' grafana_ldap_posix_groups: "false"
grafana_ldap_g_search_filter: '(&(objectClass=posixGroup)(memberUid=%s))' grafana_ldap_g_search_filter: (&(objectClass=posixGroup)(memberUid=%s))
grafana_ldap_g_search_filter_user_attr: 'uid' grafana_ldap_g_search_filter_user_attr: uid
grafana_ldap_g_search_base: 'ou=groups,dc=grafana,dc=org' grafana_ldap_g_search_base: ou=groups,dc=grafana,dc=org
grafana_ldap_u_email: 'mail' grafana_ldap_u_email: mail
grafana_ldap_admin_role_group: 'cn=admins,dc=grafana,dc=org' grafana_ldap_admin_role_group: cn=admins,dc=grafana,dc=org
grafana_ldap_serverattrs_username: 'uid' grafana_ldap_serverattrs_username: uid
grafana_ldap_group_roles: grafana_ldap_group_roles:
- {dn: 'cn=users,dc=grafana,dc=org', role: 'Editor'} - { dn: "cn=users,dc=grafana,dc=org", role: Editor }
- {dn: '*', role: 'Viewer'} - { dn: "*", role: Viewer }
grafana_oauth_generic_enabled: false grafana_oauth_generic_enabled: false
grafana_oauth_client_id: '' grafana_oauth_client_id: ""
# grafana_oauth_client_secret: 'use a vault' # grafana_oauth_client_secret: 'use a vault'
grafana_oauth_auth_url: '' grafana_oauth_auth_url: ""
grafana_oauth_token_url: '' grafana_oauth_token_url: ""
grafana_oauth_api_url: '' grafana_oauth_api_url: ""
grafana_oauth_name: 'Oauth' grafana_oauth_name: Oauth
grafana_oauth_scopes: 'openid email profile' grafana_oauth_scopes: openid email profile
grafana_oauth_empty_scopes: false grafana_oauth_empty_scopes: false
grafana_tls_skip_verify_insecure: false grafana_tls_skip_verify_insecure: false
grafana_oauth_allow_signup: false grafana_oauth_allow_signup: false
grafana_oauth_auto_login: false grafana_oauth_auto_login: false
grafana_oauth_allowed_domains: '' grafana_oauth_allowed_domains: ""
grafana_oauth_use_pkce: true grafana_oauth_use_pkce: true
grafana_oauth_allow_assign_grafana_admin: false grafana_oauth_allow_assign_grafana_admin: false
# Examples: # Examples:
@ -186,16 +260,16 @@ grafana_oauth_allow_assign_grafana_admin: false
grafana_oauth_role_attribute_path: "" grafana_oauth_role_attribute_path: ""
nginx_virthosts: nginx_virthosts:
- virthost_name: '{{ ansible_fqdn }}' - virthost_name: "{{ ansible_fqdn }}"
listen: '80' listen: "80"
server_name: '{{ ansible_fqdn }}' server_name: "{{ ansible_fqdn }}"
server_aliases: '' server_aliases: ""
index: index.html index: index.html
ssl_enabled: false ssl_enabled: false
ssl_only: false ssl_only: false
ssl_letsencrypt_certs: '{{ nginx_letsencrypt_managed }}' ssl_letsencrypt_certs: "{{ nginx_letsencrypt_managed }}"
root: '{{ nginx_webroot }}' root: "{{ nginx_webroot }}"
server_tokens: 'off' server_tokens: "off"
proxy_standard_setup: true proxy_standard_setup: true
proxies: proxies:
- location: / - location: /

View File

@ -1,4 +1,3 @@
--- ---
- name: Restart grafana - name: Restart grafana
service: name=grafana-server state=restarted service: name=grafana-server state=restarted

View File

@ -9,7 +9,7 @@ galaxy_info:
license: EUPL 1.2+ license: EUPL 1.2+
min_ansible_version: '2.8' min_ansible_version: "2.8"
# To view available platforms and versions (or releases), visit: # To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/ # https://galaxy.ansible.com/api/v1/platforms/
@ -22,8 +22,8 @@ galaxy_info:
- jammy - jammy
- name: EL - name: EL
versions: versions:
- '7' - "7"
- '8' - "8"
galaxy_tags: galaxy_tags:
- grafana - grafana

View File

@ -1,5 +1,5 @@
--- ---
- block: - block:
- name: Ensure that grafana is stopped and disabled - name: Ensure that grafana is stopped and disabled
service: name=grafana-server state=stopped enabled=no service: name=grafana-server state=stopped enabled=no
@ -10,9 +10,8 @@
apt_repository: repo='{{ grafana_repo }}' state=absent update_cache=yes apt_repository: repo='{{ grafana_repo }}' state=absent update_cache=yes
when: not grafana_enabled when: not grafana_enabled
tags: [ 'grafana' ] tags: [grafana]
- block:
- block:
- name: Install the grafana repo key - name: Install the grafana repo key
apt_key: url={{ grafana_repo_key }} state=present apt_key: url={{ grafana_repo_key }} state=present
@ -21,60 +20,56 @@
- name: Install the grafana deb packages - name: Install the grafana deb packages
apt: name={{ grafana_packages }} state={{ grafana_pkg_state }} update_cache=yes cache_valid_time=1800 apt: name={{ grafana_packages }} state={{ grafana_pkg_state }} update_cache=yes cache_valid_time=1800
- name: Install the grafana configuration - name: Install the grafana configuration
ansible.builtin.ini_file: ansible.builtin.ini_file:
path: '/etc/grafana/grafana.ini' path: /etc/grafana/grafana.ini
section: '{{ item.section }}' section: "{{ item.section }}"
option: '{{ item.option }}' option: "{{ item.option }}"
value: '{{ item.value }}' value: "{{ item.value }}"
state: "{{ item.state | default('present') }}" state: "{{ item.state | default('present') }}"
mode: '0440' mode: "0440"
owner: root owner: root
group: grafana group: grafana
loop: '{{ grafana_conf }}' loop: "{{ grafana_conf }}"
notify: Restart grafana notify: Restart grafana
tags: [ 'grafana', 'grafana_conf' ] tags: [grafana, grafana_conf]
- name: Add additional grafana configurations - name: Add additional grafana configurations
ansible.builtin.ini_file: ansible.builtin.ini_file:
path: '/etc/grafana/grafana.ini' path: /etc/grafana/grafana.ini
section: '{{ item.section }}' section: "{{ item.section }}"
option: '{{ item.option }}' option: "{{ item.option }}"
value: '{{ item.value }}' value: "{{ item.value }}"
state: "{{ item.state | default('present') }}" state: "{{ item.state | default('present') }}"
mode: '0440' mode: "0440"
owner: root owner: root
group: grafana group: grafana
loop: '{{ grafana_additional_conf }}' loop: "{{ grafana_additional_conf }}"
notify: Restart grafana notify: Restart grafana
tags: [ 'grafana', 'grafana_conf' ] tags: [grafana, grafana_conf]
- name: Install the grafana LDAP configuration file - name: Install the grafana LDAP configuration file
ansible.builtin.template: ansible.builtin.template:
src: '{{ item }}.j2' src: "{{ item }}.j2"
dest: '/etc/grafana/{{ item }}' dest: /etc/grafana/{{ item }}
mode: 0440 mode: 0440
owner: root owner: root
group: grafana group: grafana
loop: '{{ grafana_ldap_conf_file }}' loop: "{{ grafana_ldap_conf_file }}"
notify: Restart grafana notify: Restart grafana
when: grafana_ldap_auth when: grafana_ldap_auth
tags: [ 'grafana', 'grafana_conf', 'grafana_ldap' ] tags: [grafana, grafana_conf, grafana_ldap]
- name: Create the local dashboards directory - name: Create the local dashboards directory
file: dest=/var/lib/grafana/dashboards state=directory mode=0755 owner=grafana group=grafana file: dest=/var/lib/grafana/dashboards state=directory mode=0755 owner=grafana group=grafana
- name: Install additional plugins, if any - name: Install additional plugins, if any
grafana_plugin: grafana_plugin:
name: '{{ item.name }}' name: "{{ item.name }}"
state: "{{ item.state | default('present') }}" state: "{{ item.state | default('present') }}"
grafana_repo: "{{ item.repo | default('https://grafana.com/api/plugins') }}" grafana_repo: "{{ item.repo | default('https://grafana.com/api/plugins') }}"
loop: '{{ grafana_additional_plugins }}' loop: "{{ grafana_additional_plugins }}"
tags: [ 'grafana', 'grafana_plugins' ] tags: [grafana, grafana_plugins]
- name: Ensure that grafana is enabled and running - name: Ensure that grafana is enabled and running
service: name=grafana-server state=started enabled=yes service: name=grafana-server state=started enabled=yes
when: grafana_enabled when: grafana_enabled
tags: [ 'grafana' ] tags: [grafana]

View File

@ -2,4 +2,4 @@
- hosts: localhost - hosts: localhost
remote_user: root remote_user: root
roles: roles:
- ansible-role-template - ansible-role-template

View File

@ -1,5 +1,4 @@
--- ---
redis_install: True redis_install: true
setup_nginx: True setup_nginx: true
nginx_use_common_virthost: True nginx_use_common_virthost: true