On 24/09/2010 03:08, Aleksey Tsalolikhin wrote:
> Problem: How to determine machine role from the hostname using Cfengine?
>
> Data: My server hostnames contain location code, department code,
> type (web/db/etc.) and environment (stage/prod/dev).
>
> For example: "lax-it-web01-prod01".
> Location: Los Angeles
> Department: IT
> Primary role: Web (first server)
> Environment: Production (first production environment)
>
>
> I am inclined to go with option 0, native to Cfengine, I just don't
> like the noise of
> 'expression => "any";' Could we please get rid of it?
>
I would really not like this semantic to be changed, as it is consitent
over the language
Maybe you should rewrite as :
classes: "webserver" or => {"lax_it_web01_prod01",
"lax_it_web02_prod01" };
classes: "nagios" or => {"lax_it_web01_prod01" };
classes: "postgress" or => {"lax_it_db01_prod01" };
classes: "zenoss" or => {"lax_it_db01_prod01" };
And you could even set up classes based on regexp, like
classes: "webserver" expression => classmatch("lax_it_web.._prod..");
(I suspect that using `-` in a class is not allowed, but i'm not 100% sure)
Regards
Nicolas
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine