Put postgresql values in a tempfile, to be loaded by helm cli

Helm 3.x does not support passing values via stdin:
https://github.com/helm/helm/issues/7002

So setup a tempfile and write the template to the tempfile to be loaded
by helm ... --values <tempfile>

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
This commit is contained in:
Bryan Hundven 2020-01-27 16:04:13 -08:00 committed by Bryan Hundven
parent 34d01f02cc
commit 1c50b8427a

View File

@ -79,19 +79,26 @@
- name: Deploy PostgreSQL (Kubernetes)
block:
- name: Template PostgreSQL Deployment (Kubernetes)
set_fact:
pg_values: "{{ lookup('template', 'postgresql-values.yml.j2') }}"
- name: Create Temporary Values File (Kubernetes)
tempfile:
state: file
suffix: .yml
register: values_file
- name: Populate Temporary Values File (Kubernetes)
template:
src: postgresql-values.yml.j2
dest: "{{ values_file.path }}"
no_log: true
- name: Deploy and Activate Postgres (Kubernetes)
shell: |
helm repo update
echo {{ pg_values | quote }} | helm upgrade {{ postgresql_service_name }} \
helm upgrade {{ postgresql_service_name }} \
--install \
--namespace {{ kubernetes_namespace }} \
--version="8.1.5" \
--values - \
--values {{ values_file.path }} \
stable/postgresql
register: kubernetes_pg_activate
no_log: true