kubernetes.core.helm_template (3.0.1) — module

Render chart templates

Authors: Mike Graves (@gravesm)

Install collection

Install with ansible-galaxy collection install kubernetes.core:==3.0.1


Add to requirements.yml

  collections:
    - name: kubernetes.core
      version: 3.0.1

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Render templates to specified directory
  kubernetes.core.helm_template:
    chart_ref: stable/prometheus
    output_dir: mycharts
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Render templates
  kubernetes.core.helm_template:
    chart_ref: stable/prometheus
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Write templates to file
  copy:
    dest: myfile.yaml
    content: "{{ result.stdout }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Render MutatingWebhooksConfiguration for revision tag "canary", rev "1-13-0"
  kubernetes.core.helm_template:
    chart_ref: istio/istiod
    chart_version: "1.13.0"
    release_namespace: "istio-system"
    show_only:
      - "templates/revision-tags.yaml"
    release_values:
      revision: "1-13-0"
      revisionTags:
        - "canary"
  register: result
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Write templates to file
  copy:
    dest: myfile.yaml
    content: "{{ result.stdout }}"

Inputs

    
chart_ref:
    description:
    - Chart reference with repo prefix, for example, C(nginx-stable/nginx-ingress).
    - Path to a packaged chart.
    - Path to an unpacked chart directory.
    - Absolute URL.
    required: true
    type: path

show_only:
    default: []
    description:
    - Only show manifests rendered from the given templates.
    elements: str
    required: false
    type: list
    version_added: 2.4.0
    version_added_collection: kubernetes.core

output_dir:
    description:
    - Output directory where templates will be written.
    - If the directory already exists, it will be overwritten.
    required: false
    type: path

set_values:
    description:
    - Values to pass to chart configuration.
    elements: dict
    required: false
    suboptions:
      value:
        description:
        - Value to pass to chart configuration (e.g phase=prod).
        required: true
        type: str
      value_type:
        choices:
        - raw
        - string
        - json
        - file
        default: raw
        description:
        - Use C(raw) set individual value.
        - Use C(string) to force a string for an individual value.
        - Use C(file) to set individual values from a file when the value itself is too
          long for the command line or is dynamically generated.
        - Use C(json) to set json values (scalars/objects/arrays). This feature requires
          helm>=3.10.0.
    type: list
    version_added: 2.4.0
    version_added_collection: kubernetes.core

binary_path:
    description:
    - The path of a helm binary to use.
    required: false
    type: path

disable_hook:
    default: false
    description:
    - Prevent hooks from running during install.
    type: bool
    version_added: 2.4.0
    version_added_collection: kubernetes.core

include_crds:
    default: false
    description:
    - Include custom resource descriptions in rendered templates.
    required: false
    type: bool

release_name:
    aliases:
    - name
    description:
    - Release name to use in rendered templates.
    required: false
    type: str
    version_added: 2.4.0
    version_added_collection: kubernetes.core

values_files:
    default: []
    description:
    - Value files to pass to chart.
    - Paths will be read from the target host's filesystem, not the host running ansible.
    - I(values_files) option is evaluated before I(values) option if both are used.
    - Paths are evaluated in the order the paths are specified.
    elements: str
    required: false
    type: list

chart_version:
    description:
    - Chart version to use. If this is not specified, the latest version is installed.
    required: false
    type: str

chart_repo_url:
    description:
    - Chart repository URL where the requested chart is located.
    required: false
    type: str

release_values:
    aliases:
    - values
    default: {}
    description:
    - Values to pass to chart.
    required: false
    type: dict

dependency_update:
    aliases:
    - dep_up
    default: false
    description:
    - Run helm dependency update before the operation.
    - The I(dependency_update) option require the add of C(dependencies) block in C(Chart.yaml/requirements.yaml)
      file.
    - For more information please visit U(https://helm.sh/docs/helm/helm_dependency/)
    type: bool
    version_added: 2.4.0
    version_added_collection: kubernetes.core

release_namespace:
    description:
    - namespace scope for this request.
    required: false
    type: str
    version_added: 2.4.0
    version_added_collection: kubernetes.core

update_repo_cache:
    default: false
    description:
    - Run C(helm repo update) before the operation. Can be run as part of the template
      generation or as a separate step.
    type: bool

Outputs

command:
  description: Full C(helm) command run by this module, in case you want to re-run
    the command outside the module or debug a problem.
  returned: always
  sample: helm template --output-dir mychart nginx-stable/nginx-ingress
  type: str
stderr:
  description: Full C(helm) command stderr, in case you want to display it or examine
    the event log.
  returned: always
  sample: ''
  type: str
stdout:
  description: Full C(helm) command stdout. If no I(output_dir) has been provided
    this will contain the rendered templates as concatenated yaml documents.
  returned: always
  sample: ''
  type: str