Forum: CFEngine Help
Subject: Re: Dynamic inbuts based on classes set from usemodule.
Author: vladi
Link to topic: https://cfengine.com/forum/read.php?3,26668,26707#msg-26707
Like this?
bundle agent idalv {
classes:
"idalv_set" expression => usemodule("idalv-cftxt","");
vars:
idalv_set::
"idalv_bundles" slist => { @(idalv_cftxt.txt_bundles) };
methods:
idalv_set::
"use-$(idalv_bundles)" usebundle => "$(idalv_bundles)";
}
bundle common dynamic {
classes:
"inputs_set" expression => usemodule("idalv-cftxt","");
vars:
inputs_set::
"inputs" slist => { "update.cf", "library.cf", "classes.cf",
"cf-execd.cf", "cf-serverd.cf", "cf-report.cf", "cleanup.cf", "reports.cf",
"an_os.cf", "an_auth.cf" }, policy => "free";
## OS_DEB is an class activated by idalv-cftxt module
inputs_set&os_deb::
"inputs" slist => { @{inputs}, "blah2.cf" }, policy => "free";
}
# global vars
bundle common g {
vars:
"workdir" string => "/var/cfengine";
"masterfiles" string => "$(workdir)/masterfiles";
"inputs" string => "$(workdir)/inputs";
"modules" string => "$(workdir)/modules";
"configs" string => "$(workdir)/cfg";
"policy_host" string => "cfengine";
"bundles" slist => { "idalv" };
}
body runagent control {
hosts => { "127.0.0.1", "10.0.0.0/8" };
}
body common control {
bundlesequence => { @(g.bundles) };
inputs => { @(dynamic.inputs) };
output_prefix => "cf3";
}
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine