Forum: Cfengine Help Subject: Re: beginners headache Author: JarleB Link to topic: https://cfengine.com/forum/read.php?3,17928,17948#msg-17948
1) Is there something wrong with this approach? Or is it advisable just to create one file for each class, like web.cf? This is the way of cfengine, you get to choose. 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)? This you can put it anywhere you like as long as it is in the bundlesequence or called by usebundle and the bundle is of type common. 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.")? Use classmatch function. 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? This is done locally by the client/agent by setting the classes needed to express enough granularity, and then use combinations of them to specify desired state (classname::) The client do not depend on server contact. The worst consequence of not reaching the server is a delayed update of the config. This is bad if you broke the config, therefor you should make sure to separate server-configuration from agent configuration in such a way that agent configuration mistakes does not kill your server. It is also possible to to make clients only pull what the need, based on context, but make sure that inputs and bundles stated in promises.cf does exist on the client it runs, or pull everything to all clients . 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"? You should let go of the thought about controlling order of execution, and concentrate on pecifying the desired state. cf-agent will run several internal loops in order to capture all necessary context, also those occuring as a result of command execution or promise results (kept/repaired) . 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. You can't tell cf-runagent to do anything else than running your cf-agent once again. Hence the only reason to use cf-runagent is if you are in a hurry to get the clients to update their config, to signal them to run their config again. This of requires that the agents already has an update bundle that actully checks for new config on the server. I have chosen to use symlinks on the server in order to point to different versions of "what to be deployed" and swap links in order to change what goes to the clients at next agent-run. This is used to stage new cfengine binaries from dev-host through test hosts, and finally to prod hosts. 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 Once again, you can set classes based on numerous built in functions, and if it is not sufficient you can use your own modules (programs that return lists of classes to set base on what you detect in your program. If you want to save some time by getting more pre-made defaults, reporting and whatnot, you should opt for the commercial version. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine