Skip to content

Instantly share code, notes, and snippets.

@mchugh19
Created June 7, 2016 13:42
Show Gist options
  • Save mchugh19/7be27ea18b5585da96e331d527d94d6b to your computer and use it in GitHub Desktop.
Save mchugh19/7be27ea18b5585da96e331d527d94d6b to your computer and use it in GitHub Desktop.
#!py
import logging
import salt.runner
import salt.client
import salt.config
log = logging.getLogger(__name__)
def check_autosign(minion_id):
opts = salt.config.master_config('/etc/salt/master')
runner = salt.runner.RunnerClient(opts)
results = runner.cmd('authminion.servicenow', [minion_id])
return results
def run():
'''
Autosign reactor
'''
minion_id = data['id']
if data.get('act') == 'pend' and check_autosign(minion_id):
log.info('Reactor accepting key for {0}'.format(minion_id))
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment