Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prometheus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible-shared
prometheus
Commits
19a7ea72
Commit
19a7ea72
authored
5 years ago
by
Thomas Schneider
Browse files
Options
Downloads
Patches
Plain Diff
grafana: Add postgres config
parent
0d6e99f6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
grafana/tasks/main.yml
+9
-0
9 additions, 0 deletions
grafana/tasks/main.yml
grafana/tasks/postgres.yml
+23
-0
23 additions, 0 deletions
grafana/tasks/postgres.yml
grafana/templates/grafana.ini.j2
+8
-2
8 additions, 2 deletions
grafana/templates/grafana.ini.j2
with
40 additions
and
2 deletions
grafana/tasks/main.yml
+
9
−
0
View file @
19a7ea72
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
grafana/tasks/postgres.yml
0 → 100644
+
23
−
0
View file @
19a7ea72
---
-
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
This diff is collapsed.
Click to expand it.
grafana/templates/grafana.ini.j2
+
8
−
2
View file @
19a7ea72
...
@@ -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]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment