Skip to content

Instantly share code, notes, and snippets.

@kevinquinnyo
Created April 12, 2016 17:29
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 kevinquinnyo/de853a13e3fc57b8bad881d32a610e81 to your computer and use it in GitHub Desktop.
Save kevinquinnyo/de853a13e3fc57b8bad881d32a610e81 to your computer and use it in GitHub Desktop.
# this file is /etc/salt/master.d/reactor.conf
reactor:
- 'salt/netapi/hook/deploy':
- /srv/salt-dev/reactor/deploy.sls
- 'salt/presence/change':
- /srv/salt-dev/reactor/dns.sls
- 'salt/netapi/hook/restart':
- /srv/salt-dev/reactor/services/restart.sls'
#!py
# this file is /srv/salt-dev/reactor/services/restart.sls
def run():
ret = {}
payload = data.get('post')
tgt = payload['tgt']
service = payload['service']
ret['Restart Service {0} for {1}'.format(service, tgt)] = {
'cmd.service.restart': [
{'tgt': tgt},
{'arg': [
service
]}
]
}
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment