template Module

May 8, 2026 ยท View on GitHub

Render template files using template syntax and copy to the connected target host.

Parameters

ParameterDescriptionTypeRequiredDefault
srcTemplate file or directory pathstringYes (or with content)-
destPath on target hoststringYes-
  • Relative paths are relative to the templates directory for the current task; task path is specified by the task's annotation kubesphere.io/rel-path.
  • Absolute paths can also be used to point to local template files.

Examples

1. Copy relative path template

- name: template relative path
  template:
    src: a.yaml
    dest: /tmp/b.yaml

2. Copy absolute path template

- name: template absolute path
  template:
    src: /tmp/a.yaml
    dest: /tmp/b.yaml

3. Copy template directory

Renders all templates in the directory and copies to the target host.

- name: template dir
  template:
    src: /tmp/tpl
    dest: /tmp