Skip to content

Instantly share code, notes, and snippets.

View gladiatr72's full-sized avatar

Stephen D. Spencer gladiatr72

View GitHub Profile
def parse(ziphandle, klass, filename):
intance=klass()
if not filename in ziphandle.namelist():
filename = filter(lambda f: f.lower() == filename.lower(), ziphandle.namelist())[0]
@gladiatr72
gladiatr72 / ovirtlay.connect.py
Created August 29, 2014 20:44
Example of ovirt-sdk creating a guest using cloud-init features (authorized_keys and root password update)
#!/usr/bin/python python
import threading
from ovirtsdk.api import API
from ovirtsdk.xml import params
from ovirtsdk.infrastructure.errors import (NoCertificatesError,
ImmutableError,
RequestError,
ConnectionError,
MissingParametersError)
@gladiatr72
gladiatr72 / check_disk.cfg
Last active August 29, 2015 14:07
salt example - using states, pillars and jinja looping
{# /srv/salt/generic/nagios/plugins/check_disk/files/map.jinja -#}
{% from "nagios/plugins/check_disk/files/map.jinja" import check_disk with context -%}
{% include ".hash_headers.jinja" -%}
{% for node in check_disk -%}
command[check_disk{{ check_disk[node]['canonical'] }}]=/usr/lib64/nagios/plugins/check_disk{{ check_disk[node]['args'] }}
{% endfor -%}
@gladiatr72
gladiatr72 / bootstrap.sls
Last active August 29, 2015 14:10
reactor
{% set minion_id = data['id'] -%}
update_minion:
local.state.orch:
- tgt: {{minion_id}}
- sls:
- minion_update
install_baseline:
@gladiatr72
gladiatr72 / 99-salt-minion-init.py
Last active February 26, 2020 20:12
IPython - saltstack profile initializers
# similar initializer for minion-side testing
import salt.config
import salt.client
import salt.loader
import salt.utils.minion as Minion_Util
import salt.config
import pprint
pp_ = pprint.PrettyPrinter(indent=4, depth=20)
pp = pp_.pprint
@gladiatr72
gladiatr72 / bootstrap.sls
Created February 11, 2015 22:42
Example orchestration states
# vim: ft=sls
#
# this inteded to be called via the orchestrate runner.
#
# Example:
# salt-run state.orchestrate orc.bootstrap pillar='{ tgt: <minion id here> }'
orcestrate_test:
@gladiatr72
gladiatr72 / jinja_test.sls
Last active April 7, 2016 17:47
reading a saltstack jinja template
some_variable = {{some_variable}}
@gladiatr72
gladiatr72 / letsencrypt_collector_with_nginx.md
Created April 26, 2016 20:09
A Centralized Collector Config for Letsencrypt using NGiNX

Purpose

The purpose of this configuration is to allow the letsencrypt-auto script to function properly from a centralized configuration management host. This allows for managing/automating the creation, deployment and renewal of certificates without resorting to retrieving trust related data from the less trusted managed hosts.

An added bonus is that the auth data stored with the renewal configuration is not littered across the enterprise.

IP Addresses or Host Names

@gladiatr72
gladiatr72 / Uthing.py
Last active June 16, 2016 18:25
saltstack, dunders and /srv/salt/_utils
# /srv/salt/_utils/thing.py
import sys as _sys
from salt.loader import utils as _utils
_anchor = _sys.modules[__name__]
def __virtual__():
setattr(_anchor, '__utilS__', _utils(__opts__, context=__context__))
@gladiatr72
gladiatr72 / deployment-status-to-env.yaml
Last active December 16, 2021 20:52
pull status elements into environment
spec:
containers:
-
name: misc
image: gladiatr72/misc:util-21
env:
-
name: POD_IP
valueFrom:
fieldRef: