I'm trying to deploy ArgoCD Helm chart with a custom values.yaml file, into a Kubernetes cluster using Ansible playbook
This is the code I'm using
- name: Deploy ArgoCD chart inside argocd namespace
kubernetes.core.helm:
name: argo
chart_ref: argo/argo-cd
release_namespace: argocd
values_files:
- /home/user/gitlab/ansible/roles/bootstrap-kubernetes/tasks/values.yaml.j2
In the values.yaml file I added variables placeholders to pass run-time values, like in this case the cluster's name
hostname: {{ variable_hostname }}
However looking into configmaps details I see that the variable placeholder hasn't been replaced by the actual variable value.
hostname: {{ variable_hostname }}
Tried also to put the variable placeholder between quote marks, but with same results.
Is this the right way to do this?
This won't work...
values_files:
- /home/user/gitlab/ansible/roles/bootstrap-kubernetes/tasks/values.yaml.j2
...because nothing in the documentation for the kubernetes.core.helm
module indicates that Ansible applies template processing to the files listed in values_files
.
You can use the inline values
parameter instead, like this:
- name: Deploy ArgoCD chart inside argocd namespace
kubernetes.core.helm:
name: argo
chart_ref: argo/argo-cd
release_namespace: argocd
values:
hostname: "{{ variable_hostname }}"