Skip to content

Instantly share code, notes, and snippets.

@nickanderson
Last active December 13, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickanderson/4953474 to your computer and use it in GitHub Desktop.
Save nickanderson/4953474 to your computer and use it in GitHub Desktop.
Woo your infrastructure
#!/var/cfengine/bin/cf-agent -KIf
# Happy Valentines Day
body common control
{
bundlesequence => { "main" };
}
bundle agent main
{
vars:
"poem[roses]" string => "red";
"poem[violets]" string => "blue";
"poem[chocolates]" string => "sweet";
"poem[you]" string => "too";
methods:
"Woo your infrastructure"
usebundle => recite("main.poem");
}
bundle agent recite(text)
{
vars:
"things" slist => getindices("$(text)");
reports:
February.Day14::
"$(things) are $($(text)[$(things)])";
}
% ./bemine.cf
R: roses are red
R: violets are blue
R: chocolates are sweet
R: you are too
!! Method invoked repairs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment