v1.0.9
This commit is contained in:
+63
-187
@@ -1,193 +1,69 @@
|
||||
---
|
||||
# tasks file for grafana
|
||||
- name: Create Grafana namespace
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: grafana
|
||||
|
||||
- name: Create PVC for MySQL
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: grafana
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 64Gi
|
||||
|
||||
- name: Create Deployment for MySQL
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: grafana
|
||||
labels:
|
||||
app: mysql
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mysql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mysql
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/mysql
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: "{{ mysql_root_password }}"
|
||||
- name: MYSQL_DATABASE
|
||||
value: grafana
|
||||
- name: MYSQL_USER
|
||||
value: grafana
|
||||
- name: MYSQL_PASSWORD
|
||||
value: "{{ grafana_mysql_password }}"
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: mysql
|
||||
|
||||
- name: Create Service for MySQL
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: grafana
|
||||
spec:
|
||||
selector:
|
||||
app: mysql
|
||||
ports:
|
||||
- port: 3306
|
||||
name: mysql
|
||||
type: ClusterIP
|
||||
|
||||
- name: Create a config map for grafana
|
||||
k8s:
|
||||
state: present
|
||||
api_version: v1
|
||||
kind: ConfigMap
|
||||
- name: Deploy Grafana
|
||||
kubernetes.core.helm:
|
||||
name: grafana
|
||||
namespace: grafana
|
||||
definition:
|
||||
data:
|
||||
ldap.toml: "{{ lookup('template', 'ldap.toml.j2') }}"
|
||||
|
||||
- name: Create Deployment for Grafana
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: grafana
|
||||
labels:
|
||||
app: grafana
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: grafana
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: grafana
|
||||
spec:
|
||||
containers:
|
||||
- name: grafana
|
||||
image: grafana/grafana
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
env:
|
||||
- name: GF_DATABASE_TYPE
|
||||
value: mysql
|
||||
- name: GF_DATABASE_HOST
|
||||
value: mysql
|
||||
- name: GF_DATABASE_USER
|
||||
value: grafana
|
||||
- name: GF_DATABASE_PASSWORD
|
||||
value: "{{ grafana_mysql_password }}"
|
||||
- name: GF_AUTH_LDAP_ENABLED
|
||||
value: "true"
|
||||
- name: GF_AUTH_LDAP_CONFIG_FILE
|
||||
value: /etc/grafana/cm/ldap.toml
|
||||
- name: GF_AUTH_LDAP_ALLOW_SIGN_UP
|
||||
value: "true"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/grafana/cm
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: grafana
|
||||
|
||||
- name: Create Service for Grafana
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: grafana
|
||||
namespace: grafana
|
||||
spec:
|
||||
selector:
|
||||
app: grafana
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 3000
|
||||
name: grafana
|
||||
type: ClusterIP
|
||||
|
||||
- name: Create Ingress
|
||||
k8s:
|
||||
state: present
|
||||
definition:
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
chart_ref: bitnami/grafana
|
||||
release_namespace: grafana
|
||||
create_namespace: true
|
||||
values:
|
||||
metrics:
|
||||
enabled: true
|
||||
admin:
|
||||
user: grafana
|
||||
password: "{{ grafana_admin_password }}"
|
||||
persistence:
|
||||
size: 32Gi
|
||||
grafana:
|
||||
extraEnvVars:
|
||||
- name: GF_DATABASE_TYPE
|
||||
value: postgres
|
||||
- name: GF_DATABASE_HOST
|
||||
value: postgresql-postgresql-ha-pgpool.postgresql.svc.cluster.local
|
||||
- name: GF_DATABASE_NAME
|
||||
value: grafana
|
||||
- name: GF_DATABASE_USER
|
||||
value: grafana
|
||||
- name: GF_DATABASE_PASSWORD
|
||||
value: "{{ grafana_admin_password }}"
|
||||
- name: GF_DATABASE_URL
|
||||
value: "postgres://grafana:{{ grafana_admin_password }}@postgresql-postgresql-ha-pgpool.postgresql.svc.cluster.local:5432/grafana"
|
||||
smtp:
|
||||
enabled: true
|
||||
user: grafana
|
||||
password: "{{ grafana_admin_password }}"
|
||||
host: postfix.eom.dev
|
||||
fromAddress: grafana@postfix.eom.dev
|
||||
fromName: Grafana
|
||||
ldap:
|
||||
enabled: true
|
||||
allowSignUp: true
|
||||
configuration: "{{ lookup('template', 'ldap.toml.j2') }}"
|
||||
ingress:
|
||||
enabled: true
|
||||
pathType: Prefix
|
||||
hostname: grafana.eom.dev
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: ca-issuer
|
||||
name: grafana
|
||||
namespace: grafana
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
rules:
|
||||
- host: grafana.eom.dev
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: /
|
||||
backend:
|
||||
service:
|
||||
name: grafana
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- grafana.eom.dev
|
||||
secretName: grafana
|
||||
tls: true
|
||||
datasources:
|
||||
secretDefinition:
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
orgId: 1
|
||||
url: http://prometheus-server.prometheus.svc.cluster.local
|
||||
version: 1
|
||||
editable: true
|
||||
isDefault: true
|
||||
- name: Alertmanager
|
||||
uid: alertmanager
|
||||
type: alertmanager
|
||||
access: proxy
|
||||
orgId: 1
|
||||
url: http://prometheus-alertmanager.prometheus.svc.cluster.local:9093
|
||||
version: 1
|
||||
editable: true
|
||||
|
||||
Reference in New Issue
Block a user