Skip to content

Instantly share code, notes, and snippets.

@iggy
iggy / master-reactor.conf
Created April 15, 2015 16:05
reactor calling orchestrate
reactor:
- 'salt/minion/*repo*/start':
- salt://salt/reactor/repo_start.sls
# See http://serverfault.com/questions/538218/deploy-ssh-key-from-master-to-minion-via-salt-pillars
{% for user, data in salt['pillar.get']('users', {}).iteritems() %}
add_{{ user }}:
user.present:
uid: {{ data['uid'] }}
{% endfor %}
# vim : set ft=yaml tabstop=2 sts=2 sw=2 et ai si
# Tell each db server to run the pgsql command to coalesce the database
coalesce_db:
salt.function:
- name: postgres.psql_query
- tgt: 'tags:db'
- tgt_type: grain
- arg:
- "select pg_start_backup('foo');"
# we want our salt master to run the cloud snapshot script
@iggy
iggy / -etc-salt-master.d-60reactor.conf
Created April 1, 2015 01:16
sync all on minion start
# /etc/salt/master.d/60reactor.conf
# reactor config for salt master
reactor:
- 'salt/minion/*/start':
- salt://salt/reactor/sync_all.sls
salt:
minion:
grains:
roles:
- salt_master
mine_functions:
#test.ping: []
network.interfaces: []
network.get_hostname: []
disk.usage: []
grains.item:
- tags
- roles
@iggy
iggy / pillar-apps-app1.sls
Created March 7, 2015 01:19
multiple states/pillar/etc example
mysql:
# Manage databases
database:
- foo
- bar
schema:
foo:
load: True
source: salt://mysql/files/foo.schema
bar:
@iggy
iggy / pillar-nginx-dev.sls
Created March 7, 2015 00:43
2 pillars 1 state
nginx:
rootdir: /data/installer
server-name: dev.domain.com
sudo salt '*repo*' state.sls aptly.publish_repos
dev-repo01.c.oncenter-oasis-dns-project.oncenter.com.internal:
----------
ID: import_gpg_pub_key
Function: cmd.run
Name: gpg --no-tty --import /var/lib/aptly/repo/public/public.gpg
Result: False
Comment: Command "gpg --no-tty --import /var/lib/aptly/repo/public/public.gpg" run
Started: 23:46:37.022431
Duration: 102.384 ms
reactor:
- 'salt/minion/*/start':
- /srv/reactor/sync_all.sls
- /srv/reactor/graphite_event.sls