infrastructure/k8s/roles/prometheus/tasks/main.yaml

37 lines
1 KiB
YAML
Raw Normal View History

---
- name: Add Prometheus chart repo
kubernetes.core.helm_repository:
name: prometheus-community
repo_url: https://prometheus-community.github.io/helm-charts
- name: Create observability namespace
kubernetes.core.k8s:
name: observability-system
api_version: v1
kind: Namespace
state: present
definition:
metadata:
labels:
prometheus: default
- name: Create Grafana admin credentials secret
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: grafana-admin-credentials
namespace: observability-system
data:
user: "{{ grafana.admin.user | b64encode }}"
password: "{{ grafana.admin.password | b64encode }}"
- name: Deploy Prometheus chart
kubernetes.core.helm:
name: prometheus
chart_ref: prometheus-community/kube-prometheus-stack
release_namespace: observability-system
chart_version: 43.2.0
release_values: "{{ lookup('ansible.builtin.template', 'values.yaml.j2') | from_yaml }}"