Question

I am trying few features of CFENGINE 3.5 and stuck with a very basic issue. I want to copy certain files which are kept in cfengine Policy hub to various cfengine clients. These files are spread into various locations and further cfengine should copy these files to targeted machines on same location as master server has. How to do this ?

Was it helpful?

Solution

If you want to copy certain files from the hub onto the same location on the clients, you can do something like this:

vars:
  "files" slist => { "/some/file", "/other/file", "/one/more/file" };

files:
  "$(files)"
    copy_from => secure_cp("$(files)", "$(sys.policy_hub)");

This will loop over the files, copying each one in turn. Make sure you include the appropriate standard library file to secure_cp(), something like this:

body common control 
{
  inputs => { "lib/3.5/files.cf" };
  bundlesequence => { ... };
}

OTHER TIPS

https://cfengine.com/docs/3.5/examples-policy-copy-single-files.html

This might help.

Thanks & Regards,
Alok Thaker

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top