Skip to content

file.copy

Copy files with checksum verification and atomic writes

Properties

Property Type Required Description
backup boolean No -
checksum string No -
dest string Yes -
follow_symlinks boolean No -
force boolean No -
group string No -
mode string No -
owner string No -
src string Yes -

Examples

# Copy a config file with explicit mode + owner
- name: Drop the systemd unit
  file.copy:
    src: ./files/myapp.service
    dest: /etc/systemd/system/myapp.service
    mode: "0644"
    owner: root
    group: root
  become: true

Platform Support

linux, darwin, windows, freebsd

Events Emitted

  • file.copied