Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support RedHat Family #35

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions grafana/files/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ logs = {{ server.path.logs }}
#################################### Server ####################################
[server]
# Protocol (http or https)
{%- if 'protocol' in server %}
protocol = {{ server.protocol }}
{%- else %}
;protocol = http
{% endif %}

# The ip address to bind to, empty will bind to all interfaces
http_addr = {{ server.bind.address }}
Expand All @@ -29,14 +33,22 @@ http_addr = {{ server.bind.address }}
http_port = {{ server.bind.port }}

# The public facing domain name used to access grafana from a browser
{%- if 'domain' in server %}
domain = {{ server.domain }}
{%- else %}
;domain = localhost
{%- endif %}

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false

# The full public facing url
{%- if 'root_url' in server %}
root_url = {{ server.root_url }}
{%- else %}
;root_url = %(protocol)s://%(domain)s:%(http_port)s/
{%- endif %}

# Log web requests
;router_logging = false
Expand Down
4 changes: 2 additions & 2 deletions grafana/files/ldap.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ port = {{ ldap_params.port }}
use_ssl = {{ ldap_params.use_ssl|lower }}

# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
start_tls = false
start_tls = {{ ldap_params.start_tls|lower }}
# set to true if you want to skip ssl cert validation
ssl_skip_verify = false
ssl_skip_verify = {{ ldap_params.ssl_skip_verify|lower }}
# set to the path to your root CA certificate or leave unset to use system defaults
# root_ca_cert = /path/to/certificate.crt

Expand Down
3 changes: 3 additions & 0 deletions grafana/init.sls
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

{%- if pillar.grafana is defined %}
include:
{%- if grafana.manage_repo and grains['os_family'] == 'RedHat' %}
- grafana.repo.redhat
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not setup repositories in formulas directly.
Repositories should be controlled by pillar and enforced by linux.system.repo state.
The reasoning is that one can use any repository to provide grafana package (eg. custom mirror, etc.) not only upstream one.

{%- endif %}
{%- if pillar.grafana.server is defined %}
- grafana.server
{%- endif %}
Expand Down
57 changes: 57 additions & 0 deletions grafana/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,55 @@ Debian:
host: '127.0.0.1'
port: 389
use_ssl: false
start_tls: false
ssl_skip_verify: false
bind_dn: "cn=admin,dc=grafana,dc=org"
bind_password: "grafana"
user_search_filter: "(cn=%s)"
user_search_base_dns:
- "dc=grafana,dc=org"
servers:
attributes:
name: "givenName"
surname: "sn"
username: "cn"
member_of: "memberOf"
email: "email"
admin:
user: admin
password: admin
allow_sign_up: False
allow_org_create: False
auto_assign_role: Viewer
dir:
static: /usr/share/grafana/public
dashboards:
enabled: false
RedHat:
pkgs:
- grafana
service: grafana-server
user: grafana
group: grafana
path:
home: /usr/share/grafana
data: /var/lib/grafana
logs: /var/log/grafana
pid_file_dir: /var/run/grafana
bind:
address: 0.0.0.0
port: 3000
session:
engine: file
auth:
engine: application
ldap:
enabled: false
host: '127.0.0.1'
port: 389
use_ssl: false
start_tls: false
ssl_skip_verify: false
bind_dn: "cn=admin,dc=grafana,dc=org"
bind_password: "grafana"
user_search_filter: "(cn=%s)"
Expand Down Expand Up @@ -61,6 +110,14 @@ Debian:
engine: none
datasource: {}
dashboard: {}
RedHat:
server:
host: 127.0.0.1
port: 3000
remote_data:
engine: none
datasource: {}
dashboard: {}
{%- endload %}

{%- set client = salt['grains.filter_by'](client_defaults, merge=salt['pillar.get']('grafana:client')) %}
10 changes: 10 additions & 0 deletions grafana/repo/redhat.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
grafana:
pkgrepo.managed:
- humanname: 'grafana'
- name: 'grafana'
- baseurl: 'https://packagecloud.io/grafana/stable/el/7/$basearch'
- enabled: 1
- gpgcheck: 1
- gpgkey: https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
- sslverify: 1
- sslcacert: /etc/pki/tls/certs/ca-bundle.crt