infrastructure/k8s/roles/postgres/tasks/main.yml

44 lines
No EOL
1.1 KiB
YAML

---
- name: Create postgres namespace
kubernetes.core.k8s:
name: postgres
api_version: v1
kind: Namespace
state: present
definition:
metadata:
labels:
prometheus: default
- name: Create Postgres secret
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Secret
metadata:
name: postgres-credentials
namespace: postgres
data:
postgres-password: "{{ PostgresPassword | b64encode }}"
- name: Add Bitnami chart repo
kubernetes.core.helm_repository:
name: bitnami
repo_url: https://charts.bitnami.com/bitnami
- name: Deploy Postgres chart
kubernetes.core.helm:
name: default-postgres
chart_ref: bitnami/postgresql
release_namespace: postgres
chart_version: 11.9.13
release_values: "{{ lookup('ansible.builtin.file', 'values.postgres.yaml') | from_yaml }}"
- name: Deploy Postgres 15
kubernetes.core.helm:
name: postgres-15
chart_ref: bitnami/postgresql
release_namespace: postgres
chart_version: 12.1.6
release_values: "{{ lookup('ansible.builtin.file', 'values.postgres15.yaml') | from_yaml }}"