Forum: Cfengine Help
Subject: dynamic classes using variables.
Author: chadpatt
Link to topic: https://cfengine.com/forum/read.php?3,22543,22543#msg-22543
I have an interesting issue. I need to create some class names that are
specific to the host.
In this case I have a file that looks like this.
server1.somedomain.com:example_dev1_brm_app:example_dev1_brm:example_dev1:example
server2.somedomain.com:example_dev2_brm_app:example_dev2_brm:example_dev2:example
server3.somedomain.com:example_dev1_brm_db:example_dev1_brm:example_dev1:example
server4.somedomain.com:example_dev3_brm_db:example_dev3_brm:example_dev3:example
..... about 300 servers total.
and this is my example I am working with.
bundle agent example
{
vars:
"dim_array" int =>
readstringarray("array_name","$(sys.workdir)/inputs/hostclasses.csv","\s*#[^\n]*",":",100,4000);
classes:
"$(array_name[$(sys.host)][1])" expression => "any";
reports:
example_dev1_brm_app::
"blah ";
"$(array_name[$(sys.host)][1])":: <-- is this possible?
"yeah, this worked..."
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine