On Mar 21, 2012, at 08:34, no-re...@cfengine.com wrote:
> Forum: CFEngine Help
> Subject: Check if host is in the list
> Author: rprots
> Link to topic: https://cfengine.com/forum/read.php?3,25333,25333#msg-25333
>
> I have the list of hosts as variable:
>
> vars:
> "staging"
> slist => {
> "node-staging1",
> "node-staging2",
> "node-staging-test1",
> "node-staging-test2",
> "st1",
> "st3",
> },
>
>
> I want to have class "staging_profile" registered if cf-agent is running on
> any host in the list.
You don't have to define the hostnames as variables, as the hostname is already
automatically
defined as a class. Something like this should work:
classes:
"staging_profile" or => { classmatch("node-staging.*"), classmatch("st[0-9]")
};
Or if your staging hosts can match the regexp node-staging.* :
classes:
"staging_profile" expression => classmatch("node-staging.*");
Regards,
Erik
--
Erik Mouw -- erik.m...@snow.nl
Snow B.V. -- http://snow.nl/
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine