37 lines
1.4 KiB
YAML
37 lines
1.4 KiB
YAML
---
|
|
- name: Prometheus | Add prometheus-community Helm repo
|
|
ansible.builtin.command: helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
|
|
environment:
|
|
KUBECONFIG: "{{ logging_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
register: _helm_repo_add
|
|
changed_when: "'already exists' not in _helm_repo_add.stdout"
|
|
failed_when: _helm_repo_add.rc != 0 and 'already exists' not in _helm_repo_add.stdout
|
|
|
|
- name: Prometheus | Update chart repositories
|
|
ansible.builtin.command: helm repo update
|
|
environment:
|
|
KUBECONFIG: "{{ logging_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
changed_when: false
|
|
|
|
- name: Prometheus | Render values
|
|
ansible.builtin.template:
|
|
src: prometheus-values.yml.j2
|
|
dest: /tmp/prometheus-values.yml
|
|
mode: "0600"
|
|
|
|
- name: Prometheus | Install or upgrade kube-prometheus-stack
|
|
ansible.builtin.command: >
|
|
helm upgrade --install kube-prometheus-stack prometheus-community/kube-prometheus-stack
|
|
--namespace {{ logging_namespace }}
|
|
--version {{ prometheus_stack_chart_version }}
|
|
--values /tmp/prometheus-values.yml
|
|
--timeout 10m0s
|
|
--wait
|
|
environment:
|
|
KUBECONFIG: "{{ logging_kubeconfig }}"
|
|
PATH: "/usr/local/bin:/usr/bin:/bin"
|
|
register: _helm_install
|
|
changed_when: "'STATUS: deployed' in _helm_install.stdout or 'has been upgraded' in _helm_install.stdout"
|