Skip to content

Instantly share code, notes, and snippets.

@mgwilliams
Last active August 29, 2015 13:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mgwilliams/8986670 to your computer and use it in GitHub Desktop.
Save mgwilliams/8986670 to your computer and use it in GitHub Desktop.
import logging
try:
import nacl.state
from nacl.auto import *
from nacl.run import run
HAS_NACL = True
except ImportError:
HAS_NACL = False
# Set up logging
log = logging.getLogger(__name__)
__virtualname__ = 'nacl'
def __virtual__():
if not HAS_NACL:
log.info('NACL Renderer Loaded')
return False
return True
def render(template, saltenv='base', sls='', tmplpath=None, rendered_sls=None, **kws):
log.warning(kws)
pillar = __pillar__
grains = __grains__
salt = __salt__
exec(template.read())
return run()
#!nacl
Service.running(pillar.get('service', 'nginx'))
#this is totally contrived
interfaces = salt['network.interfaces']()
File.exists('interface-tmp', names=['/tmp/interface-{}'.format(i) for i in interfaces.keys()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment