refactor(grafana): split defaults
This commit is contained in:
parent
2183832a3c
commit
492e134f4a
@ -1,50 +1,4 @@
|
|||||||
---
|
---
|
||||||
grafana_user: grafana
|
|
||||||
grafana_version: "11.3.0"
|
|
||||||
grafana_base_path: "/opt/grafana"
|
|
||||||
grafana_config_path: "{{ grafana_base_path }}/config"
|
|
||||||
grafana_config_file: "{{ grafana_config_path }}/grafana.ini"
|
|
||||||
grafana_ldap_config_file: "{{ grafana_config_path }}/ldap.toml"
|
|
||||||
grafana_provisioning_path: "{{ grafana_config_path }}/provisioning"
|
|
||||||
grafana_notifier_provisioning_path: "{{ grafana_provisioning_path }}/notifiers"
|
|
||||||
grafana_dashboard_provisioning_path: "{{ grafana_provisioning_path }}/dashboards"
|
|
||||||
grafana_datasource_provisioning_path: "{{ grafana_provisioning_path }}/datasources"
|
|
||||||
grafana_plugin_provisioning_path: "{{ grafana_provisioning_path }}/plugins"
|
|
||||||
grafana_data_path: "{{ grafana_base_path }}/data"
|
|
||||||
grafana_logs_path: "{{ grafana_base_path }}/logs"
|
|
||||||
grafana_state: present
|
|
||||||
|
|
||||||
grafana_run_user: >-
|
|
||||||
{{ ('uid' in (grafana_user_info | default([]))) | ternary(grafana_user_info.uid, grafana_user) }}
|
|
||||||
grafana_run_group: >-
|
|
||||||
{{ ('group' in (grafana_user_info | default([]))) | ternary(grafana_user_info.group, grafana_user) }}
|
|
||||||
|
|
||||||
grafana_container_image_server: "docker.io"
|
|
||||||
grafana_container_image_namespace: "grafana"
|
|
||||||
grafana_container_image_container: "grafana"
|
|
||||||
grafana_container_image_name: >-
|
|
||||||
{{
|
|
||||||
[
|
|
||||||
((grafana_container_image_server is defined)
|
|
||||||
| ternary([ grafana_container_image_server ], [])),
|
|
||||||
((grafana_container_image_namespace is defined)
|
|
||||||
| ternary([ grafana_container_image_namespace], [])),
|
|
||||||
grafana_container_image_container,
|
|
||||||
] | ansible.builtin.flatten | join('/')
|
|
||||||
}}
|
|
||||||
grafana_container_image: >-
|
|
||||||
{{ grafana_container_image_name }}:{{ grafana_container_image_tag | default(grafana_version, true) }}
|
|
||||||
|
|
||||||
grafana_container_name: grafana
|
|
||||||
grafana_container_base_volumes:
|
|
||||||
- "{{ grafana_config_path }}:{{ grafana_container_config_path }}:ro"
|
|
||||||
- "{{ grafana_data_path }}:{{ grafana_container_data_path }}:rw"
|
|
||||||
- "{{ grafana_logs_path }}:{{ grafana_container_logs_path }}:rw"
|
|
||||||
grafana_container_volumes: []
|
|
||||||
grafana_container_collected_volumes: >-
|
|
||||||
{{ grafana_container_base_volumes + grafana_container_volumes }}
|
|
||||||
grafana_container_restart_policy: "unless-stopped"
|
|
||||||
|
|
||||||
grafana_config_log_mode:
|
grafana_config_log_mode:
|
||||||
- console
|
- console
|
||||||
- file
|
- file
|
26
roles/grafana/defaults/main/container.yml
Normal file
26
roles/grafana/defaults/main/container.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
grafana_container_image_server: "docker.io"
|
||||||
|
grafana_container_image_namespace: "grafana"
|
||||||
|
grafana_container_image_container: "grafana"
|
||||||
|
grafana_container_image_name: >-2
|
||||||
|
{{
|
||||||
|
[
|
||||||
|
((grafana_container_image_server is defined)
|
||||||
|
| ternary([ grafana_container_image_server ], [])),
|
||||||
|
((grafana_container_image_namespace is defined)
|
||||||
|
| ternary([ grafana_container_image_namespace], [])),
|
||||||
|
grafana_container_image_container,
|
||||||
|
] | ansible.builtin.flatten | join('/')
|
||||||
|
}}
|
||||||
|
grafana_container_image: >-2
|
||||||
|
{{ grafana_container_image_name }}:{{ grafana_container_image_tag | default(grafana_version, true) }}
|
||||||
|
|
||||||
|
grafana_container_name: grafana
|
||||||
|
grafana_container_base_volumes:
|
||||||
|
- "{{ grafana_config_path }}:{{ grafana_container_config_path }}:ro"
|
||||||
|
- "{{ grafana_data_path }}:{{ grafana_container_data_path }}:rw"
|
||||||
|
- "{{ grafana_logs_path }}:{{ grafana_container_logs_path }}:rw"
|
||||||
|
grafana_container_volumes: []
|
||||||
|
grafana_container_collected_volumes: >-2
|
||||||
|
{{ grafana_container_base_volumes + grafana_container_volumes }}
|
||||||
|
grafana_container_restart_policy: "unless-stopped"
|
20
roles/grafana/defaults/main/main.yml
Normal file
20
roles/grafana/defaults/main/main.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
grafana_user: grafana
|
||||||
|
grafana_version: "11.3.0"
|
||||||
|
grafana_base_path: "/opt/grafana"
|
||||||
|
grafana_config_path: "{{ grafana_base_path }}/config"
|
||||||
|
grafana_config_file: "{{ grafana_config_path }}/grafana.ini"
|
||||||
|
grafana_ldap_config_file: "{{ grafana_config_path }}/ldap.toml"
|
||||||
|
grafana_provisioning_path: "{{ grafana_config_path }}/provisioning"
|
||||||
|
grafana_notifier_provisioning_path: "{{ grafana_provisioning_path }}/notifiers"
|
||||||
|
grafana_dashboard_provisioning_path: "{{ grafana_provisioning_path }}/dashboards"
|
||||||
|
grafana_datasource_provisioning_path: "{{ grafana_provisioning_path }}/datasources"
|
||||||
|
grafana_plugin_provisioning_path: "{{ grafana_provisioning_path }}/plugins"
|
||||||
|
grafana_data_path: "{{ grafana_base_path }}/data"
|
||||||
|
grafana_logs_path: "{{ grafana_base_path }}/logs"
|
||||||
|
grafana_state: present
|
||||||
|
|
||||||
|
grafana_run_user: >-
|
||||||
|
{{ ('uid' in (grafana_user_info | default([]))) | ternary(grafana_user_info.uid, grafana_user) }}
|
||||||
|
grafana_run_group: >-
|
||||||
|
{{ ('group' in (grafana_user_info | default([]))) | ternary(grafana_user_info.group, grafana_user) }}
|
@ -2,7 +2,7 @@
|
|||||||
- name: Ensure grafana_state is valid
|
- name: Ensure grafana_state is valid
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- "grafana_state in ['present', 'absent']"
|
- "grafana_state in grafana_states"
|
||||||
fail_msg: >-
|
fail_msg: >-
|
||||||
Only 'present' and 'absent' are allowed as values for grafana_state
|
Only 'present' and 'absent' are allowed as values for grafana_state
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
grafana_states:
|
||||||
|
- present
|
||||||
|
- absent
|
||||||
grafana_container_config_path: "/etc/grafana"
|
grafana_container_config_path: "/etc/grafana"
|
||||||
grafana_container_data_path: "/var/lib/grafana"
|
grafana_container_data_path: "/var/lib/grafana"
|
||||||
grafana_container_logs_path: "/var/log/grafana"
|
grafana_container_logs_path: "/var/log/grafana"
|
||||||
|
Loading…
Reference in New Issue
Block a user