Forum: Cfengine Help
Subject: Re: Client config examples (update.cf / failsafe.cf) for multiple 
Master Policy Servers
Author: msvob...@linkedin.com
Link to topic: https://cfengine.com/forum/read.php?3,22618,22634#msg-22634


Hi,

In the copy_from body template, the servers is a list, ordered (meaning 
it'll try the first server, then the second if the first dosen't answer, 
etc)

You can combine it with "select_class" which randomnly set a class from 
a list ( 
http://cfengine.com/manuals/cf3-reference.html#select_005fclass-in-classes )

And you end up with something like :

bundle agent copy {
   classes:
     "selection" select_class => { "one", "two", "three" };
   files:
     "/tmp/test1-copy"
        copy_from => multiple_cp("/tmp/testfile1",
                              "host1", "host2", "host3");
}

body copy_from multiple_cp(from, server1, server2, server3) {
   source => "$(from)";
   one::    servers => { "$(server1)", "$(server3)",  "$(server2)" };
   two::    servers => { "$(server2)", "$(server1)",  "$(server3)" };
   three::    servers => { "$(server3)", "$(server2)",  "$(server1)" };
}

Regards
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine



Rock on!  Thanks Nicolas!  I wasn't aware of select_class.  That is handy 
indeed!

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to