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 hr_bytes(size): | |
''' | |
This just returns the bytes in a human readable format. | |
''' | |
hr = lambda s:[(s%1024**i and "%.1f"%(s/1024.0**i) or str(s/1024**i))+x.strip() for i,x in enumerate(' KMGTPEZY') if s<1024**(i+1) or i==8][0] | |
return hr(size) |
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
include: | |
- apt | |
# our custom sources | |
/etc/apt/sources.list.d/fatbox.list: | |
file: | |
- managed | |
- source: salt://fatbox/debian/apt/fatbox.list | |
- owner: root | |
- group: root |
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
""" | |
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
/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 |