Created
March 1, 2012 02:41
-
-
Save nickanderson/1946826 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
body common control { | |
bundlesequence => { | |
"main", | |
}; | |
inputs => { | |
"cfengine_stdlib.cf", | |
}; | |
} | |
bundle agent main { | |
vars: | |
"list" slist => { "1", "2", "3" }; | |
methods: | |
"any" usebundle => test("@(main.list)"); | |
} | |
bundle agent test(l) { | |
files: | |
"/tmp/testfile" | |
create => "true", | |
edit_line => append_if_no_lines("@(test.l)"), | |
comment => "add the lines we want to the file"; | |
"/tmp/testfile" | |
edit_line => delete_lines_not_matching("@(test.l)"), | |
comment => "delete lines that arent in our list"; | |
} | |
bundle edit_line delete_lines_not_matching(list) { | |
delete_lines: | |
"!$(list).*" | |
comment => "Delete lines do not match our ips or are not comments"; | |
reports: | |
cfengine:: | |
"$(list)"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment