kubekey/docs/en/modules/copy.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.3 KiB

copy Module

The copy module allows users to copy files or directories to connected target hosts.

Parameters

Parameter Description Type Required Default
src Source file or directory path string No (required if content is empty) -
content Content of the source file or directory string No (required if src is empty) -
dest Destination path on the target host string Yes -

Usage Examples

  1. Copy a relative path file to the target host
    The relative path is under the files directory corresponding to the current task. The current task path is specified by the task annotation kubesphere.io/rel-path.
- name: copy relative path
  copy:
    src: a.yaml
    dest: /tmp/b.yaml
  1. Copy an absolute path file to the target host
    Local absolute path file:
- name: copy absolute path
  copy:
    src: /tmp/a.yaml
    dest: /tmp/b.yaml
  1. Copy a directory to the target host
    Copies all files and directories under the directory to the target host:
- name: copy dir
  copy:
    src: /tmp
    dest: /tmp
  1. Copy content to a file on the target host
- name: copy content
  copy:
    content: hello
    dest: /tmp/b.txt