Forum: Cfengine Help Subject: beginners headache Author: sebastian Link to topic: https://cfengine.com/forum/read.php?3,17928,17928#msg-17928
Hello, i need some coaching or some "real-word" examples for cfengine3. I started with the basic configuration and used the configuration guides i found on blog o' matty. cfengine-server and client now is up and runnig. But now i have problems to proceed with some practical configurations and have some basic questions: Most of our configurations depends on a) server-type like, web, database, application-server etc. b) geographical location, for example duesseldorf, berlin or munich c) system-type, for example solaris global or non-global-zones If I have understood correctly, these types of decisions should be implemented in form of classes. Therefore i would like to organize my masterfile-directory as follows: masterfiles: ./type/ -->web -->dbs -->app ./location/ -->duesseldorf -->berlin -->munich ./sys/ -->globalzone -->non-global-zone Depending on the type of "decision" i would save all promises in the correspondig directory. In order the defaultrouter-setting depends on the geographical location i would save "defrouter.cf" in /masterfiles/loc/berlin/defrouter.cf etc. 1) Is there something wrong with this approach? Or is it advisable just to create one file for each class, like web.cf? 2)I would like to create a classes.cf, where all classes can be defined centralized. Where should this classes.cf-file be "implentend" ideally (promise.cf or update.cf)? 3) How can i define the classes dependent on the hostname: For expamle hostnames are like "XXXXweb". How can i define classes based on hostnames with "regular expressions" (in this case class webserver by parsing the last 3 letters.")? 4) How can i ensure, that only those configurations get pulled, which are needed? Or let me ask differently: How does the server know, that he is a web-server,in berlin, running in a non-global-zone and nothing else? 5) How do i control the order of these promises. I know that bundlesequences are provided for it. But how exaclty should i define, that the promises of "server-type" should be "interpreted" before promises of "location"? 6) I want to ensure, that some promises, for example software-deployments, can only manually be executed with cf-runagent. In order to do so, i would create a separate class "deploy", which then can be quoted as an option for the cf-runagent. I have read about "runagent control promises", but still don't understand, how to hide promises of class "deploy" from being automatically executed. 7) Last but not least: we have various testing-environments too. That means configurations or promises concering "server-type" web-server by example, will vary depending on whether they are located in production or testing-environment. I have read that this can also be done by defining a variable for example branch = ( PROD ) branch = ( TEST ) But how could i practically use this variable, for example in a add_user.cf that will add different users in different environments? The bottom line is, that i need some more practical examples beyond "hello-world" or maybe something like a "design guideline" or "cookbook". I am very grateful for any help. Thanks in advance to whoever spend the time. Sebastian _______________________________________________ Help-cfengine mailing list [email protected] https://cfengine.org/mailman/listinfo/help-cfengine
