Skip to content

Instantly share code, notes, and snippets.

Created June 18, 2015 17:34
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 anonymous/34eb10171c9a87b0717d to your computer and use it in GitHub Desktop.
Save anonymous/34eb10171c9a87b0717d to your computer and use it in GitHub Desktop.
appName: varnish
bin: varnish
tags:
- ssl
- front
- slunch
- nginx
- cache
- lb
base:
'Pakhet*':
- applications.pakhet
'Folk*':
- applications.folk
'Griffon*':
- applications.griffon
'Advertising*':
- applications.advertising
'Cassandra*':
- applications.cassandra
'Varnish*':
- applications.varnish
/tmp/{{ pluginName }}.tar.gz:
file.managed:
- source: salt://newrelic/plugins/{{ appName }}/files/{{ pluginName }}.tar.gz
- mode: 600
plugin-get:
cmd.run:
- user: root
- name: |
rm -rf /opt/local/etc/{{ pluginName }}
mkdir -p /opt/local/etc/{{ pluginName }}
tar -zxvf /tmp/{{ pluginName }}.tar.gz --strip-components=1 -C /opt/local/etc/{{ pluginName }}
- require:
- file: /tmp/{{ pluginName }}.tar.gz
/opt/local/etc/{{ pluginName }}/config/newrelic.json:
file.managed:
- source: salt://newrelic/plugins/files/conf/newrelic.json
- mode: 600
- require:
- cmd: plugin-get
/opt/local/etc/{{ pluginName }}/config/plugin.json:
file.managed:
- source: salt://newrelic/plugins/files/conf/plugin.json
- template: jinja
- mode: 600
- require:
- cmd: plugin-get
/opt/local/lib/svc/manifest/newrelic-{{ appName }}-plugin.xml:
file.managed:
- source: salt://newrelic/plugins/{{ appName }}/files/newrelic-{{ appName }}-plugin.xml
- require:
- file: /opt/local/etc/{{ pluginName }}/config/plugin.json
validate newrelic-plugin manifest:
cmd.wait:
- name: svccfg validate /opt/local/lib/svc/manifest/newrelic-{{ appName }}-plugin.xml
- cwd: /
- watch:
- file: /opt/local/lib/svc/manifest/newrelic-{{ appName }}-plugin.xml
import newrelic-plugin manifest:
cmd.wait:
- name: svccfg import /opt/local/lib/svc/manifest/newrelic-{{ appName }}-plugin.xml
- cwd: /
- watch:
- cmd: validate newrelic-plugin manifest
enable newrelic-plugin manifest:
cmd.wait:
- name: /usr/sbin/svcadm enable application/newrelic-{{ appName }}-plugin
- cwd: /
- watch:
- cmd: import newrelic-plugin manifest
application/newrelic-{{ appName }}-plugin:
service:
- running
- enable: true
- watch:
- cmd: enable newrelic-plugin manifest
base:
'*':
- ssh-key
- openjdk
- newrelic.server
'tags:ssl':
- certs
- stunnel
'tags:front':
- match: pillar
- geoip
'tags:nginx':
- match: pillar
- nginx
'tags:cache':
- match: pillar
- certs
- stunnel
- newrelic.plugins.plugin
- varnish
'tags:moksha':
- match: pillar
- newrelic.agent
- moksha
'tags:database':
- match: pillar
- newrelic.plugins.plugin
- cassandra
include:
- git
git@git.misterbell.com:admin-system/dispatcher.git:
git.latest:
- rev: master
- target: /opt/dispatcher
- identity: /root/.ssh/id_rsa
- require:
- pkg: git
- file: /root/.ssh/id_rsa
varnish:
pkg:
- installed
- refresh: True
pkgsrc/varnish:
service:
- running
- enable: True
- require:
- file: /opt/local/etc/default.vcl
- watch:
- cmd: enable varnish manifest
/opt/local/etc/default.vcl:
file.managed:
- source: salt://varnish/files/default.vcl
- template: jinja
/opt/reload_varnish.sh:
file.managed:
- source: salt://varnish/files/reload_varnish.sh
- tempalte: jinja
- require:
- service: pkgsrc/varnish
reload varnish:
cmd.run:
- name: source /opt/reload_varnish.sh
- require:
- file: /opt/reload_varnish.sh
/opt/varnish.xml:
file.managed:
- source: salt://varnish/files/varnish.xml
validate varnish manifest:
cmd.wait:
- name: svccfg validate /opt/varnish.xml
- cwd: /
- watch:
- file: /opt/varnish.xml
import varnish manifest:
cmd.wait:
- name: svccfg import /opt/varnish.xml
- cwd: /
- watch:
- cmd: validate varnish manifest
enable varnish manifest:
cmd.wait:
- name: /usr/sbin/svcadm enable pkgsrc/varnish
- cwd: /
- watch:
- cmd: import varnish manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment