Search code examples
kubernetesansiblekubernetes-helm

How do I pass custom values.yaml to Helm via Ansible?


I am trying to install Helm charts from local path via ansible using the following module:

- name: Deploy Elasticsearch chart from local path
    community.kubernetes.helm:
      name: es
      chart_ref: ./elasticsearch
      kubeconfig_path: ./kubeconfig
      release_namespace: elasticsearch
      create_namespace: true

The chart is present in the directory ./elasticsearch and this method by default refers to the values.yaml. But I want the chart to refer to a file that was created with custom values (custom-values.yaml). How do I force the helm module in ansible to use the custom-values.yaml file?


Solution

  • According to the documentation here you are looking for the 'values_files' parameter.

    - name: Deploy Elasticsearch chart from local path
        community.kubernetes.helm:
          name: es
          chart_ref: ./elasticsearch
          kubeconfig_path: ./kubeconfig
          release_namespace: elasticsearch
          create_namespace: true
          values_files:
          - /custom-values.yaml
    

    should do the trick for you