Skip to content
Snippets Groups Projects
Commit 19a7ea72 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

grafana: Add postgres config

parent 0d6e99f6
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,15 @@ ...@@ -81,6 +81,15 @@
- config - config
- grafana - grafana
- import_tasks: postgres.yml
when:
- grafana_database is defined
- grafana_database.type == "postgres"
- grafana_database.host[0] == '/'
tags:
- grafana
- postgres
- meta: flush_handlers - meta: flush_handlers
- name: Enable and start Grafana - name: Enable and start Grafana
......
---
- become: true
become_user: postgres
block:
- name: Create postgres user
postgresql_user:
name: grafana
state: present
- name: Create database
postgresql_db:
name: grafana
owner: grafana
state: present
- name: Grant database privileges
postgresql_privs:
database: grafana
privs: ALL
state: present
type: database
roles: grafana
...@@ -18,8 +18,14 @@ serve_from_sub_path = {{ grafana_serve_from_sub_path }} ...@@ -18,8 +18,14 @@ serve_from_sub_path = {{ grafana_serve_from_sub_path }}
socket = /run/grafana/sock socket = /run/grafana/sock
[database] [database]
{% if grafana_database_url is defined %} {% if grafana_database is defined %}
url = {{ grafana_database_url }} type = {{ grafana_database.type }}
host = {{ grafana_database.host }}
name = {{ grafana_database.name }}
user = {{ grafana_database.user }}
{% if grafana_database.password is defined %}
password = """{{ grafana_database.password }}"""
{% endif %}
{% endif %} {% endif %}
[analytics] [analytics]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment