This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
base: | |
'*': | |
# account details are available everywhere | |
- users.accounts | |
# ops group data | |
- users.ops | |
# individual users on a given machine | |
- users.nodeusers | |
'web*': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger script when updated: | |
file.managed: | |
- name: /usr/local/bin/script.sh | |
- source: salt://script.sh | |
- mode: 700 | |
cmd.wait: | |
- name: /usr/local/bin/script.sh | |
- cwd: /tmp | |
- watch: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# ######################################################################################### #} | |
{# ######################################################################################### #} | |
{# this block of code auto applies salt states to a given minion if they exist on the master #} | |
{% set id = grains['id'] %} | |
{# web01 host id = 'web' cluster id, allow a custom grain or pillar named 'cluster' to override #} | |
{% set cluster = salt['config.get']('cluster', id.split('.')[0].rstrip('0123456789')) %} | |
{# all available states on the master #} | |
{% set states = salt['cp.list_master']() %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# _grains/myenv.py | |
import sys | |
import socket | |
import re | |
import platform | |
# Extend the default list of supported distros. This will be used for the | |
# /etc/DISTRO-release checking that is part of platform.linux_distribution() | |
from platform import _supported_dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get logs from other states | |
{% set mylogs = [] %} | |
{% for myfile in salt['cp.list_master']() %} | |
{% if myfile.split('/')[-1] == "log.incl" %} | |
{% include myfile %} | |
{% endif %} | |
{% endfor %} | |
# {{ mylogs }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script surrounds the command passed in with start and finish notifications | |
# to the cronitor monitoring application. | |
# | |
# === SETUP | |
# | |
# * Make sure the cronitor script is executable. | |
# | |
# chmod +x cronitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Override Rails.env so we can have a env method that support this environment plus or minus other environments as true | |
# This initializer file is named 01_rails so it executes before any others | |
module Rails | |
# Mini-helper class which subclasses String, duplicating the base of ActiveSupport::StringInquirer | |
# Adds support for comparing hierarchy of environments, the method_name vs. current Rails.env | |
# | |
# Rails.env # => "development" | |
# Rails.env.development? # => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
num=5 | |
retrycode=99 | |
sleep=300 | |
usage() { | |
cat <<EOF | |
$0 [-r retry_exit_code] [-s sleep_secs] [-n times_to_loop] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pathadd() { | |
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then | |
PATH="$1:${PATH:+"$PATH:"}" | |
fi | |
} | |
# rbenv setup | |
export RBENV_ROOT=/opt/rbenv | |
pathadd /opt/rbenv/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT val, | |
CASE | |
WHEN by5+by3 = 0 THEN 'FizzBuzz' | |
WHEN by5 = 0 THEN 'Fizz' | |
WHEN by3 = 0 THEN 'Buzz' | |
ELSE cast(val AS varchar) | |
END AS fizzbuzz_test | |
FROM | |
(SELECT val, | |
mod(val, 5) AS by5, |
OlderNewer