On 17 March 2010 23:37, Justin Lloyd <[email protected]> wrote:
>
> Ok, I'm stumped again. I've been working on a problem for hours. I want
> to effectively do the following on each client:
>
> client# scp policy_host:/usr/local/etc/*.rc /usr/local/etc
>
> but I can't figure out how to set up the access rules and files promise.
> I keep getting either access errors or a copy of the directory itself
> (i.e. "."), not the *.rc files in the remote directory. Note that the
> client's /usr/local/etc directory may well be empty, so I don't have a
> list of files to update. I just want all of the remote location's *.rc
> files.
Does it have to be done using scp? I thought cf3 used secure
connections, so that you could use cf3's copy_from, such as in
update.cf below. I'm not sure if you can use wildcards in line 33
below, so maybe this will copy the whole directory, not only the *.rc
files.
- Erlend
r...@m5000# cat -n update.cf
1
#------------------------------------------------------------------------
2 bundle agent update{
3 vars:
4 "policyserver" string => "10.0.1.230";
5 "policyfiles" string => "/export/cfengine/master";
6 "cf3binaries" string => "/usr/local/sbin";
7
8 files:
9
10
#---------------------------------------------------------------------
11 #get policy files from policy server
12 "${sys.workdir}/inputs"
13 handle => "update_policy_files",
14 copy_from => getfiles("${policyserver}", "${policyfiles}"),
15 depth_search => recurse;
16
17
#---------------------------------------------------------------------
18 #get cf3 binaries from policy server
19 "/var/cfengine/bin"
20 handle => "cf3_update_binaries",
21 #perms => u_p("700"),
22 copy_from => getfiles("${policyserver}","${cf3binaries}"),
23 depth_search => recurse,
24 action => immediate;
25 }
26
27
#------------------------------------------------------------------------
28 #define body of the getfiles "subroutine"
29 body copy_from getfiles(server, path) {
30 servers => { "${server}" };
31 encrypt => "true";
32 trustkey => "true";
33 source => "${path}";
34 compare => "digest";
35 preserve => "true";
36 verify => "true";
37 purge => "true";
38 }
39
40
#------------------------------------------------------------------------
41 body depth_search recurse {
42 depth => "inf";
43 }
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine