| # Copyright (c) 2022 VEXXHOST, Inc. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| # not use this file except in compliance with the License. You may obtain |
| # a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations |
| # under the License. |
| |
| - name: Retrieve "etcd" CA certificate |
| ansible.builtin.slurp: |
| src: /etc/kubernetes/pki/etcd/ca.crt |
| register: _etcd_ca_crt |
| |
| - name: Retrieve "etcd" client certificate |
| ansible.builtin.slurp: |
| src: /etc/kubernetes/pki/etcd/healthcheck-client.crt |
| register: _etcd_healthcheck_client_crt |
| |
| - name: Retrieve "etcd" client key |
| ansible.builtin.slurp: |
| src: /etc/kubernetes/pki/etcd/healthcheck-client.key |
| register: _etcd_healthcheck_client_key |
| |
| - name: Create namespace |
| kubernetes.core.k8s: |
| state: present |
| definition: |
| apiVersion: v1 |
| kind: Namespace |
| metadata: |
| name: monitoring |
| |
| - name: Create Secret with "etcd" TLS certificates |
| kubernetes.core.k8s: |
| state: present |
| definition: |
| apiVersion: v1 |
| kind: Secret |
| metadata: |
| name: kube-prometheus-stack-etcd-client-cert |
| namespace: monitoring |
| data: |
| ca.crt: "{{ _etcd_ca_crt.content }}" |
| healthcheck-client.crt: "{{ _etcd_healthcheck_client_crt.content }}" |
| healthcheck-client.key: "{{ _etcd_healthcheck_client_key.content }}" |
| |
| - name: Deploy Helm chart |
| kubernetes.core.k8s: |
| state: present |
| definition: |
| - apiVersion: helm.toolkit.fluxcd.io/v2beta1 |
| kind: HelmRelease |
| metadata: |
| name: kube-prometheus-stack |
| namespace: monitoring |
| spec: |
| interval: 60s |
| chart: |
| spec: |
| chart: kube-prometheus-stack |
| version: 36.2.0 |
| sourceRef: |
| kind: HelmRepository |
| name: prometheus-community |
| install: |
| crds: CreateReplace |
| upgrade: |
| crds: CreateReplace |
| values: "{{ _kube_prometheus_stack_values | combine(kube_prometheus_stack_values, recursive=True) }}" |