Add grafana dashboard

This commit is contained in:
Adrien Reslinger 2024-11-20 14:54:47 +01:00
parent 7106bb0230
commit 0a4d421bb6
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
5 changed files with 4349 additions and 1 deletions

View file

@ -38,6 +38,25 @@
# wait_sleep: 5
# wait_timeout: 360
- name: Install crowdsec grafana dashboard
kubernetes.core.k8s:
state: "present"
context: "{{ my_context }}"
namespace: "{{ crowdsec_namespace }}"
apply: yes
definition:
apiVersion: v1
kind: ConfigMap
metadata:
labels:
grafana_dashboard: "1"
name: crowdsec-grafana-dashboards
data:
Crowdsec Details per Machine.json: "{{ lookup('file', 'Crowdsec Details per Machine.json') | from_json }}"
Crowdsec Insight.json: "{{ lookup('file', 'Crowdsec Insight.json') | from_json }}"
Crowdsec Overview.json: "{{ lookup('file', 'Crowdsec Overview.json') | from_json }}"
LAPI Metrics.json: "{{ lookup('file', 'LAPI Metrics.json') | from_json }}"
- name: Configure traefik bouncer access
block:
# kubectl --context bach -n crowdsec exec deploy/crowdsec-lapi -c crowdsec-lapi -- cscli bouncers list -o raw | grep '^traefik,'
@ -49,7 +68,7 @@
check_mode: false
rescue:
# kubectl --context bach -n crowdsec exec deploy/crowdsec-lapi -c crowdsec-lapi -- cscli bouncers add traefik -o raw
- name: Test if traefik bouncer already existe
- name: Create traefik bouncer key
ansible.builtin.command: kubectl --context {{ my_context }} -n {{ crowdsec_namespace }} exec deploy/crowdsec-lapi -c crowdsec-lapi -- cscli bouncers add traefik -o raw
delegate_to: localhost
register: traefik_bouncer_token