Last active
November 22, 2018 12:25
-
-
Save mpdehaan/87d0ea05ed11a9b723d555a566d27ee3 to your computer and use it in GitHub Desktop.
Revisions
-
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,12 @@ class FooRole(Foo): def set_bundles(self): return [ "ext/foo.yml" ] def set_resources(self): # you can still add resources the normal way, they will come before before bundle def set_handlers(self): # same ============= # ext/foo.yml -
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,8 @@ class FooRole(Foo): def set_bundles(self): return [ "ext/foo.yml" ] ============= # ext/foo.yml -
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,11 +25,11 @@ resources: - File: name: "/etc/motd" from_template: "templates/motd.j2" mode__eval: "mode" # just to show we can load variables, but we still need to be explicit. signals: "spork" - Echo: msg: "hello {{ x }}, sometimes" when__eval: "Chaos.random() > 2.5" handlers: - Echo: msg: "foo" -
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,12 +5,12 @@ # ================== class FooRole(Foo): def set_resources(self) return Resources().add_bundle(resources="ext/foo.yml") def set_handlers(self): return Handlers().add_bundle(handlers="ext/foo.yml") ============= -
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 9 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,13 +21,14 @@ search_path: resources: - Set: mode: 0770 x: 4567 - File: name: "/etc/motd" from_template: "templates/motd.j2" mode: "Eval(mode)" # just to show we can load variables, but we still need to be explicit. signals: "spork" - Echo: msg: "hello {{ x }}, sometimes" when: "Chaos.random() > 2.5" handlers: - Echo: @@ -43,5 +44,9 @@ if you want any variables you need to Eval() implementation: reads YAML file, dynamically returns resources from it. you could still mix bundle files with regular python resources, even in the same role. -
mpdehaan revised this gist
Nov 22, 2018 . 1 changed file with 26 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,47 @@ # I don't know about this? # most people should prefer the Python DSL # but what if some teams don't want to learn Python? # here's an OPTIONAL idea for a new capability # ================== class FooRole(Foo) def resources(self) return Resources().add_bundle(resources="ext/foo.yml") def handlers(self): return Handlers().add_bundle(handlers="ext/foo.yml") ============= # ext/foo.yml search_path: - opsmop.core.types resources: - Set: mode: 0770 - File: name: /etc/motd from_file: blarg mode: "Eval(mode)" signals: "spork" - Echo: msg: "hello {{ x }}" when: "Chaos.random() > 2.5" handlers: - Echo: msg: "foo" handles: "spork" ========= if I do this, this would clearly be a second class citizen to the main behaviors limitations: when always results in an Eval() if you want any variables you need to Eval() implementation: reads YAML file, dynamically returns resources from it. -
mpdehaan created this gist
Nov 21, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # I don't know about this? class FooRole(Foo) def resources(self) return Resources().add_bundle(resources="ext/foo.yml") def handlers(self): return Resources().add_bundle(handlers="ext/foo.yml") ============= Resources: - File: name: /etc/motd from_file: blarg signals: "spork" - Echo: msg: "hello {{ xyz }}" when: "Chaos.random() > 2.5" Handlers: - Echo: msg: "foo" handles: "spork"