On 26 February 2010 08:06, Seifert, Christian <christian.seif...@gesis.de>wrote:

>  Hello everybody,
>
> for my IT education i have to do a automatically file transfer from a
> policy server to any client servers with cfengine. Has anyone a hint or an
> example configuration on his machines which could help me?
>
I am not quite sure what you mean, but the standard failsafe.cf,
update.cfautomatically transfers files from the policy server when
required. If there
is a change in a file in eg /var/cfengine/inputs, then line 12 in
inputs.cfbelow kicks in and transfers the required files from
policyserver:/export/cfengine/master
into /var/cfengine/inputs on the clent. Is this what you are looking for?

- Erlend

r...@m5000# cat -n failsafe.cf
    1
 #------------------------------------------------------------------------
    2  #simply include and execute the update.cf file
    3  body common control {
    4     bundlesequence => { "update" };
    5     inputs => { "update.cf" };
    6  }

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
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to