infrastructure/k8s/roles/prometheus/tasks/main.yaml
Peter Kurfer 0ac1d722a3
All checks were successful
continuous-integration/drone/push Build is passing
refactor: postgres-operator and migration
2023-11-08 21:28:51 +01:00

51 lines
No EOL
2.4 KiB
YAML

---
- 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: Update Prometheus operator CRDs
# kubernetes.core.k8s:
# state: present
# definition: "{{ lookup('ansible.builtin.url', item, split_lines=False) | from_yaml }}"
# loop:
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_alertmanagers.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_podmonitors.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_probes.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_prometheusrules.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
# - https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.66.0/example/prometheus-operator-crd/monitoring.coreos.com_thanosrulers.yaml
- name: Deploy Prometheus chart
kubernetes.core.helm:
name: prometheus
chart_ref: prometheus-community/kube-prometheus-stack
release_namespace: observability-system
chart_version: 47.3.0
update_repo_cache: true
release_values: "{{ lookup('ansible.builtin.template', 'values.yaml.j2') | from_yaml }}"