copy module

The module that puts a file on a host, either copied from the control node or written from content given in the task.

In more detail

It compares the existing file's content and permissions with what you asked for and writes only if they differ, so a repeat run reports ok. Its dest argument names the file to write, and content supplies the text directly. For text that needs variables filled in, use the template module instead.

Example

ansible.builtin.copy:
  content: "enabled\n"
  dest: app.conf

Related terms

Taught in

References

Certification courses