Copy single files

Table of Contents

This is a standalone policy example that will copy single files, locally (local_cp) and from a remote site (secure_cp). The CFEngine Standard Library ( should be included in the /var/cfengine/inputs/libraries/ directory and inputs list as below.

body common control
      bundlesequence  => { "mycopy" };
      inputs => { "$(sys.libdir)/" };

bundle agent mycopy

Path and name of the file we wish to copy to

      comment => "/tmp/test_plain promises to be an up-to-date copy of /bin/echo to demonstrate copying a local file",
      copy_from => local_cp("$(sys.workdir)/bin/file");

Copy locally from path/filename

      comment => "/tmp/test_plain_remote promises to be a copy of cfengine://",
      copy_from => secure_cp("/repo/config-files/motd", "");

Copy remotely from path/filename and specified host ```

This policy can be found in /var/cfengine/share/doc/examples/ and downloaded directly from github.