1

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 ?

Yogesh
  • 577
  • 6
  • 16

2 Answers2

2

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 => { ... };
}
Diego Zamboni
  • 543
  • 2
  • 9
  • @Mr zzamboni : Here you have defined all the source files which needs to be copied, will the location of all be same on targeted clients, is there any way to define some different location on client? – Yogesh Sep 25 '13 at 11:29
0

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

This might help.

Thanks & Regards,
Alok Thaker

linux_fanatic
  • 4,358
  • 3
  • 16
  • 20