W3cubDocs

/Ansible

kubernetes.core.helm_template – Render chart templates

Note

This plugin is part of the kubernetes.core collection (version 1.2.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install kubernetes.core.

To use it in a playbook, specify: kubernetes.core.helm_template.

Synopsis

  • Render chart templates to an output directory or as text of concatenated yaml documents.

Parameters

Parameter Choices/Defaults Comments
binary_path
path
The path of a helm binary to use.
chart_ref
path / required
Chart reference with repo prefix, for example, nginx-stable/nginx-ingress.
Path to a packaged chart.
Path to an unpacked chart directory.
Absolute URL.
chart_repo_url
string
Chart repository URL where the requested chart is located.
chart_version
string
Chart version to use. If this is not specified, the latest version is installed.
include_crds
boolean
    Choices:
  • no
  • yes
Include custom resource descriptions in rendered templates.
output_dir
path
Output directory where templates will be written.
If the directory already exists, it will be overwritten.
release_values
dictionary
Default:
{}
Values to pass to chart.

aliases: values
update_repo_cache
boolean
    Choices:
  • no
  • yes
Run helm repo update before the operation. Can be run as part of the template generation or as a separate step.
values_files
list / elements=string
Default:
[]
Value files to pass to chart.
Paths will be read from the target host's filesystem, not the host running ansible.
values_files option is evaluated before values option if both are used.
Paths are evaluated in the order the paths are specified.

Examples

- name: Render templates to specified directory
  kubernetes.core.helm_template:
    chart_ref: stable/prometheus
    output_dir: mycharts

- name: Render templates
  kubernetes.core.helm_template:
    chart_ref: stable/prometheus
  register: result

- name: Write templates to file
  copy:
    dest: myfile.yaml
    content: "{{ result.stdout }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
command
string
always
Full helm command run by this module, in case you want to re-run the command outside the module or debug a problem.

Sample:
helm template --output-dir mychart nginx-stable/nginx-ingress
stderr
string
always
Full helm command stderr, in case you want to display it or examine the event log.

stdout
string
always
Full helm command stdout. If no output_dir has been provided this will contain the rendered templates as concatenated yaml documents.



Authors

  • Mike Graves (@gravesm)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/kubernetes/core/helm_template_module.html