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
/etc/salt/minion: | |
file: | |
- managed | |
- owner: root | |
- group: root | |
- mode: 444 | |
- source: salt://salt/files/salt-minion.config | |
- template: jinja | |
- context: | |
{% if grains['fqdn'] == 'clients.fatbox.ca' %} |
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
{% macro postconf(key, value) -%} | |
postconf-{{ key }}: | |
cmd: | |
- run | |
- name: | |
- postconf -e {{ key }}='{{ value }}' | |
- unless: test "x$(postconf -h {{ key }} )" = 'x{{ value }}' | |
- require: | |
- pkg: postfix |
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
#!/usr/bin/env python | |
import salt.cli.caller | |
import salt.config | |
import argparse | |
import sys | |
parser = argparse.ArgumentParser(description='Check if minions are online.') | |
parser.add_argument('hostname', help='The name of the minion to be checked') | |
args = parser.parse_args() |
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 allows you to import Django modules into a Salt module | |
""" | |
import logging | |
import sys | |
import os | |
log = logging.getLogger(__name__) |
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
class Mock(object): | |
def __init__(self): | |
history = [] | |
unmet_expectations = [] | |
def __call__(self, func, *args, **kwargs): | |
""" | |
Here we can grab a copy of the actual function/state and insert | |
the Mock object as __salt__ so the usual calls to |
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
def which(exe=None): | |
''' | |
Python clone of POSIX's /usr/bin/which | |
''' | |
if exe: | |
(path, name) = os.path.split(exe) | |
if os.access(exe, os.X_OK): | |
return exe | |
for path in os.environ.get('PATH').split(os.pathsep): | |
full_path = os.path.join(path, exe) |
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
/home/kojiadmin/.koji/config: | |
file.managed: | |
- source: salt://koji/files/config | |
- user: kojiadmin | |
- group: kojiadmin | |
- mode: 644 | |
- makedirs: true | |
- template: jinja | |
- context: | |
kojiweb_url: "http://koji2.egavas.org/koji/" |
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
/etc/redis/redis.conf: | |
file.managed: | |
- source: salt://redis/redis.conf | |
- user: redis | |
- group: redis | |
- mode: 644 | |
- template: jinja | |
- require: | |
- file: /etc/redis | |
- cmd: 'make && make install' |
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
import yaml | |
import yaml.constructor | |
try: | |
# included in standard lib from Python 2.7 | |
from collections import OrderedDict | |
except ImportError: | |
# try importing the backported drop-in replacement | |
# it's available on PyPI | |
from ordereddict import OrderedDict |
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
ganglia-monitor: | |
pkg: | |
- installed | |
service: | |
- running | |
# Since the service name is ganglia-monitor and the daemon binary is gmond | |
- sig: '^gmond' | |
- watch: | |
- file: /etc/ganglia/gmond.conf | |
- pkg: ganglia-monitor |