Last active
December 13, 2015 18:09
-
-
Save nickanderson/4953474 to your computer and use it in GitHub Desktop.
Woo your infrastructure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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)])"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ./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