kubekey/docs/en/modules/template.md
liujian 192af7bb7e
feat: add Chinese README and documentation updates (#2791)
- Introduced a new Chinese version of the README file (README_zh-CN.md) to enhance accessibility for Chinese-speaking users.
- Updated the English README to reflect new features and installation instructions.
- Added detailed documentation for project structure, playbooks, roles, tasks, and modules to improve user understanding and usability.

Signed-off-by: [Your Name] <[Your Email]>
Signed-off-by: redscholar <blacktiledhouse@gmail.com>
2025-09-30 10:00:07 +08:00

1.2 KiB

template Module

The template module allows users to parse a template file and copy it to the connected target host.

Parameters

Parameter Description Type Required Default
src Path to the original file or directory string No (required if content is empty) -
dest Destination path on the target host string Yes -

Usage Examples

  1. Copy a relative path file to the target host Relative paths are under the templates directory of the current task. The current task path is specified by the task annotation kubesphere.io/rel-path.
- name: copy relative path
  template:
    src: a.yaml
    dest: /tmp/b.yaml
  1. Copy an absolute path file to the target host Local template file with an absolute path
- name: copy absolute path
  template:
    src: /tmp/a.yaml
    dest: /tmp/b.yaml
  1. Copy a directory to the target host Parse all template files in the directory and copy them to the target host
- name: copy dir
  template:
    src: /tmp
    dest: /tmp
  1. Copy content to the target host
- name: copy content
  template:
    content: hello
    dest: /tmp/b.txt