Skip to content

Instantly share code, notes, and snippets.

View UtahDave's full-sized avatar

David Boucha UtahDave

View GitHub Profile
@UtahDave
UtahDave / i3.conf
Last active August 29, 2015 14:12 — forked from diyan/i3.conf
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@UtahDave
UtahDave / gist:b106dcc802523381854a
Created November 26, 2014 20:07
Use jinja to check for a directory
# NOTE: This example is probably not using the rvm state correctly
# This is just to show how to use jinja to only run a state if
# a path exists
{% set mypath = '/var/my/path' %}
{% if salt['file.exists'](mypath) %}
remove_ruby:
rvm.remove
{% endif %}
Verifying that +utahdave is my openname (Bitcoin username). https://onename.io/utahdave
@UtahDave
UtahDave / icinga.py
Last active January 11, 2020 22:54 — forked from d--j/icinga.py
'''
Manages Icinga Passive Check delivery
'''
import logging
import logging.handlers
import os
import signal
LOG_LEVELS = (logging.WARNING, logging.INFO, logging.DEBUG)
base:
'*':
- base
- service-common
- order: 1
{% for root in opts['pillar_roots']['base'] -%}
{% set service_group_sls = '{0}/{1}.sls'.format(root, grains['service_group']) -%}
{% if salt['file.file_exists'](service_group_sls) %}
'service_group:{{ grains["service_group"] }}':
- match: grain
<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:
@UtahDave
UtahDave / gist:665c086547b44cb3ebe1
Created September 22, 2014 17:40
Example of Salt State directory layout
.
├── bacula
│   ├── client.sls
│   └── server.sls
├── bprobe
│   └── init.sls
├── cpall.sls
├── dirty-users
│   ├── exports
│   ├── group -> /etc/group
@UtahDave
UtahDave / server.py
Created September 18, 2014 16:09
Example of a Salt execution module that "fires and forgets" a command that may not ever return correctly.
from subprocess import Popen
def start_server():
cmd_str = 'coffee /tmp/app/app.coffee'
proc = Popen([cmd_str], shell=True,
stdin=None, stdout=None, stderr=None, close_fds=True)
return cmd_str
@UtahDave
UtahDave / example.md
Last active August 29, 2015 14:06 — forked from ryan-lane/example.md

modules/modules/testme.py:

from salt.exceptions import CommandExecutionError

def testme(name):
    if name == 'fail':
        raise CommandExecutionError('test error message')
    else:
        return True
@UtahDave
UtahDave / pycrypto.sls
Created September 2, 2014 21:01
Salt State to remove annoying warning on Amazon Linux. - WARNING - DOES NOT ACTUALLY FIX THE ISSUE. THIS JUST SUPPRESSES THE WARNING.
# TEMP: Disable warnings after installing apache-libcloud
# Try disabling this after future versions of apache-libcloud are released
disable_libgmp_warning:
file.replace:
- name: /usr/lib64/python2.6/site-packages/Crypto/Util/number.py
- pattern: 'if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:'
- repl: '#if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:'
disable_RandomPool_warning_line1:
file.replace:
- name: /usr/lib64/python2.6/site-packages/Crypto/Util/randpool.py