Skip to content

Instantly share code, notes, and snippets.

@kevinquinnyo
Created December 16, 2015 19:39
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/55f1442c2895b9f7b14b to your computer and use it in GitHub Desktop.
Save kevinquinnyo/55f1442c2895b9f7b14b to your computer and use it in GitHub Desktop.
#!py
def install(states):
# we're pinned to 14.04 / trusty, but building some logic for future when possible
oscodename = __grains__['oscodename']
states['varnish-repo'] = {
'pkgrepo.managed': [
{'humanname': 'Varnish Cache 4.0'},
{'name': 'deb https://repo.varnish-cache.org/ubuntu/ {0} varnish-4.0'.format(oscodename)},
{'dist': oscodename},
{'file': '/etc/apt/sources.list.d/varnish-cache.list'},
{'gpgcheck': 1},
{'key_url': 'https://repo.varnish-cache.org/GPG-key.txt'},
{'require_in': [
{'pkg': 'varnish'}
]}
]
}
states['varnish'] = {
'pkg.installed': [
{'service.running': {
'require': [
{'pkgrepo': 'varnish-repo'},
{'sls': 'cache.varnish.config'}
],
}}
]
}
return states
def run():
include = [
{'base': 'cache.varnish.config'}
]
states = {'include': include}
states = install(states)
return states
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment