Forum: Cfengine Help
Subject: Re: Separating clients into groups
Author: zzamboni
Link to topic: https://cfengine.com/forum/read.php?3,20902,20904#msg-20904
Lucas,
This is what classes are for. You can check the hostname using the
automatically-defined hard classes, or even group them according to their
function. For example:
classes:
"mailserver" or => { "mgt07", "mgt16" };
files:
mailserver::
"/etc/sendmail.cf"
copy_from => [ stuff to copy server sendmail.cf ]
!mailserver::
"/etc/sendmail.cf"
copy_from => [ stuff to copy client sendmail.cf ]
For the specific case of copying files according to certain class and variable
definitions, you can use a technique called hierarchical copying. I have
written about how to do it in cfengine3 in my blog:
http://blog.zzamboni.org/tag/hierarchicalcopy
In short, using hierarchical copy you could have files named (for example)
"sendmail.cf.mailserver", "sendmail.cf.mailclient" and even host-specific ones
like "sendmail.cf.host123", and the correct, most-specific one will be
automatically copied to sendmail.cf automatically, by using the same promises
in all hosts.
Best regards,
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine