Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
@njpatel
njpatel / etc-salt-reactor
Created January 24, 2014 19:00
Fun with salt, basically running scripts on master when events are fired via the Reactor system. The names of the files are paths with - replacing /
<contents of normal file>
# Add any additional locations to look for master runners
runner_dirs: [/srv/runners]
# Register a reactor whenever a cloud provider emits 'created'
# the * is the name of the VM, we want any, but you could
# do something like salt/cloud/Webservers-*/created if you only
# wanted your webservers
reactor:
@rgbkrk
rgbkrk / fabfile.py
Last active December 25, 2015 16:49
Fabric file for creating named servers on Rackspace and bootstrapping them as salt minions.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Bootstrapping the salt minions on Rackspace (using fabric rather than
salt-cloud).
This is not the most effective way to do this, but it gets it done.
@whiteinge
whiteinge / saltshell.py
Last active November 30, 2016 01:29
The planning stages of a for-development shell environment for Salt
#!/usr/bin/env python
'''\
Welcome to the Salt repl which exposes the execution environment of a minion in
a pre-configured Python shell
__opts__, __salt__, __grains__, and __pillar__ are available.
Jinja can be tested with full access to the above structures in the usual way:
JINJA("""\\
@andreagrandi
andreagrandi / gdata_read.py
Last active October 30, 2019 22:30
Read a Google Docs spreadsheet document from Python.
# Copyright (c) 2013, Andrea Grandi and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,
@whiteinge
whiteinge / formula-util.sh
Last active June 28, 2017 16:45
Functions to more easily work with a ton of organization repos
#!/bin/bash
# Functions to more easily work with a ton of organization repos
#
# Requires ok.sh and Git.
#
# Available commands: ${ALL_FUNCS}
# Lazyness!
ok="$(which ok.sh)"
eval "$(awk '$0 ~ /^_helptext/, /^}/ { print }' $ok)"
{# localhost_present_host:}
# host.present:
# - ip: 127.0.0.1
# - name: {{ grains['id'] }} #}
local_address_host:
host.absent:
- ip: 127.0.1.1
{% if grains['ec2_local-ipv4'] is defined -%}
@godber
godber / gist:5777861
Last active December 18, 2015 11:48
A Salt SLS Module for managing a per host /etc/salt/minion.d/grains.conf file based on matching host IDs. If there is a host.conf file, that will be used, if not, then default.conf will be used.
salt-minion:
pkg:
- installed
service:
- running
- require:
- pkg: salt-minion
- watch:
- file: /etc/salt/minion.d/grains.conf
@hdonnay
hdonnay / mk_freeze.sh
Last active December 18, 2015 00:59
Helper script to use esky with salt
#!/bin/sh
trap '[ -f patch.$$ ] && patch -R < patch.$$' 0
PATH="$PATH:`pwd`/patchelf/src"
set -e
#exec >/dev/null
[ -f setup.py ] || { printf "You seem to be in the wrong directory.\n"} >&2; exit 1; }
if ! which patchelf >/dev/null 2>&1; then
printf "Couldn't find 'patchelf', going to download and compile.\n" >&2
git clone https://github.com/NixOS/patchelf
(
@auser
auser / informer.py
Last active December 15, 2015 04:29
"""
This enables us to call the minions and search for a specific role
"""
import logging
# Import salt libs
import salt.utils
import salt.payload
@auser
auser / database.yml
Last active August 25, 2016 23:57
The first iteration of a `deploy` module for saltstack
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html