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

51 lines
2.3 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 }}"
2023-04-18 09:29:21 +00:00
- name: Update Prometheus operator CRDs
kubernetes.core.k8s:
state: present
definition: "{{ lookup('ansible.builtin.url', item, split_lines=False) | from_yaml }}"
loop:
2023-07-08 14:45:25 +00:00
- 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
2023-04-18 09:29:21 +00:00
- name: Deploy Prometheus chart
kubernetes.core.helm:
name: prometheus
chart_ref: prometheus-community/kube-prometheus-stack
release_namespace: observability-system
2023-07-08 14:45:25 +00:00
chart_version: 47.3.0
update_repo_cache: true
release_values: "{{ lookup('ansible.builtin.template', 'values.yaml.j2') | from_yaml }}"