Skip to content

Instantly share code, notes, and snippets.

View gravyboat's full-sized avatar

Forrest gravyboat

View GitHub Profile
@gravyboat
gravyboat / gist:7434139
Created November 12, 2013 16:37
pillar
groups:
{% if grains['os'] == 'OpenBSD' %}
group1: ['wheel', 'dialer', 'wsrc', 'www']
group3: ['3group', 'authpf', 'dialer']
{% elif grains['os'] == 'Debian' %}
group1: ['1group']
group3: ['sudo']
{% else %}
group1: ['1group']
group3: ['1group']
@gravyboat
gravyboat / gist:7435127
Last active December 28, 2015 03:29
iterating.
{% for ab, ba in pillar['groups'].iteritems() %}
{% for i in ba %}
{{ i }}:
group:
- present
{% endfor %}
{% endfor %}
@gravyboat
gravyboat / gist:8307503
Last active January 2, 2016 12:59
multiple crons in states, NOTE: This is really not that great a way to do things, in reality we should have all sorts of fancy pillar naming going on, and cool sourcing, but this is the quick and dirty workaround.
----------------
livedb_crons.sls
----------------
/cron.livedb:
file.directory:
- user: root
- group: root
- mode: 644
- makedirs: True
@gravyboat
gravyboat / gist:8347229
Last active January 2, 2016 18:59
libmemcached-remove
libmemcached-remove:
pkg.removed:
- name: libmemcached-dev
- version: '<1.0.16-1'
@gravyboat
gravyboat / gist:8609195
Last active January 4, 2016 10:29
includes for apache
apache/init.sls #This is simply our init which starts the service, and sets up this one managed file for the service (this could be broken out further):
apache_service:
service:
- name: {{ pillar['pkgs']['apache'] }}
- enable: True
- running
---------------------------------------------
apache/files.sls #Here we manage our other files:
@gravyboat
gravyboat / gist:8609279
Last active January 4, 2016 10:29
incldues for apache 2
apache/files.sls #Here we manage our other files:
apache_conf:
file.managed:
- name: {{ pillar['pkgs_settings']['apache_sites_available'] }}/graphite
- source: salt://graphite_server/files/apache/graphite
- template: jinja
apache_link:
file.symlink:
@gravyboat
gravyboat / gist:8677472
Created January 28, 2014 22:04
snmpd testing
snmpd:
pkg:
- installed
service:
- running
- name: snmpd
- require:
- pkg: snmpd
snmpd.conf:
@gravyboat
gravyboat / gist:8945670
Created February 11, 2014 22:34
referencing pillar
echo foo > /tmp/foo:
cmd.run:
- onlyif: test -e {{ pillar['some_file'] }}
@gravyboat
gravyboat / gist:9252904
Created February 27, 2014 15:57
gist for oznt
vts:
file.managed:
- name: /etc/apache2/sites-available/vts.cfg
- source: salt://webserver/vts.cfg
a2ensite_vts.cfg:
cmd.run:
- onlyif: test ! -L /etc/apache2/sites-enabled/vts.cfg
- watch:
- file: vts
@gravyboat
gravyboat / haproxy.conf
Created February 27, 2014 19:02
example haproxy conf.
{% if grains['hostname'] == 'myHost' %}
param1 = value1
{% elif grains['hostname'] == 'myOtherHost' %}
param1 = value2
{% else %}
param1 = value3
{% endif %}
You could also do: