Skip to content

Instantly share code, notes, and snippets.

@mgwilliams
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save mgwilliams/8986670 to your computer and use it in GitHub Desktop.

Select an option

Save mgwilliams/8986670 to your computer and use it in GitHub Desktop.

Revisions

  1. mgwilliams revised this gist Feb 14, 2014. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion service.sls
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    #!nacl

    Service.running(pillar.get('service', 'nginx'))
    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()])
  2. mgwilliams created this gist Feb 14, 2014.
    33 changes: 33 additions & 0 deletions nacl_renderer.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    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()
    3 changes: 3 additions & 0 deletions service.sls
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!nacl

    Service.running(pillar.get('service', 'nginx'))