Skip to content

Instantly share code, notes, and snippets.

@mpdehaan
Last active January 13, 2019 13:53
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 mpdehaan/c0d8f3381a729a4b04c711f92ab3e856 to your computer and use it in GitHub Desktop.
Save mpdehaan/c0d8f3381a729a4b04c711f92ab3e856 to your computer and use it in GitHub Desktop.
# BEFORE
class FooRole(Role):
def set_variables(self):
return dict(
x=5
)
def set_resources(self):
return Resources(
File(name="/etc/blorp.cfg", from_template="./blorp.cfg.j2", ..., notifies="restart_blorp")
)
def set_handlers(self):
return Handlers(
restart_blorp = Service(name="blorp", restarted=True)
)
# AFTER
class FooRole(Role):
def main(self):
x = 5
blorp_result = File(name="/etc/blorp.cfg", from_template="./blorp.cfg.j2")
if blorp_result.changed():
Service(name="blorp", restarted=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment