Skip to content

Instantly share code, notes, and snippets.

@neilhwatson
Created September 18, 2014 12:37
Show Gist options
  • Save neilhwatson/fae9465229863387f70a to your computer and use it in GitHub Desktop.
Save neilhwatson/fae9465229863387f70a to your computer and use it in GitHub Desktop.
Dymanic inputs and bundlesequence without common bundles
newatson@ltipc682:~/.cfagent/inputs$ cat nocommon.cf
body common control
{
bundlesequence => { "first", @{first.bs} };
inputs => { "first.cf", @{first.inputs} };
}
newatson@ltipc682:~/.cfagent/inputs$ cat first.cf
bundle agent first
{
vars:
"bs" slist => { "main", "post" };
"inputs" slist => { "post.cf" };
classes:
"alt"
expression => "use_alt",
scope => "namespace";
}
newatson@ltipc682:~/.cfagent/inputs$ cat post.cf
bundle agent main
{
reports:
"main bundle";
}
bundle agent post
{
reports:
!alt::
"post bundle";
alt::
"alternate post bundle";
}
newatson@ltipc682:~/.cfagent/inputs$ cf-agent -V
CFEngine Core 3.5.1.e5870db
newatson@ltipc682:~/.cfagent/inputs$ cf-agent -IKf ./nocommon.cf
2013-06-17T14:07:44-0400 notice: R: main bundle
2013-06-17T14:07:44-0400 notice: R: post bundle
newatson@ltipc682:~/.cfagent/inputs$ cf-agent -IKf ./nocommon.cf -D use_alt
2013-06-17T14:07:47-0400 notice: R: main bundle
2013-06-17T14:07:47-0400 notice: R: alternate post bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment