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 bash | |
# Openstack Swift Basic API tests for check_mk | |
# straill (SwiftStack) 2017/10/16 | |
# | |
# Setup: | |
# - Ensure you have a swift account created - see SWIFT_USER below. | |
# - Then set the config varibles below for your endpoints and password. | |
# - Runs basic functional test set using some (ugly) cURL commands; returns status in check_mk format | |
# - Failures will cause us to immediately bail and return bad status |
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 | |
# Adapted from Mark Mandel's implementation | |
# https://github.com/ansible/ansible/blob/devel/plugins/inventory/vagrant.py | |
import argparse | |
import json | |
import paramiko | |
import subprocess | |
import sys | |
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
#ensure your hosts file is defined but your ansible-configuration does NOT set up an ansible_user (this is what you're creating) | |
# Ubuntu (14.04) Trusty | |
ansible -i hosts -b -K -k -u <username_with_sudo> -m user -a "name=ansible groups=sudo append=yes" hostname | |
ansible -i hosts -b -K -k -u <username_with_sudo> -m authorized_key -a "user=ansible key='<public_key_as_string>' manage_dir=yes" hostname | |
ansible -i hosts -b -K -k -u <username_with_sudo> -m lineinfile -a "dest=/etc/sudoers state=present regexp='^%sudo' line='%sudo ALL=(ALL) NOPASSWD: ALL' validate='visudo -cf %s'" hostname | |
# CentOS/RHEL 7 | |
ansible -i hosts -b -K -k -u <username_with_sudo> -m user -a "name=ansible groups=wheel append=yes" hostname | |
ansible -i hosts -b -K -k -u <username_with_sudo> -m authorized_key -a "user=ansible key='<public_key_as_string>' manage_dir=yes" hostname |
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 logging | |
from django_fsm import FSMField, transition | |
from django.db import models | |
logger = logging.getLogger(__name__) | |
class MyStatefulModel(models.Model): | |
class STATE: |
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
#ensure the yum cache is clear first | |
yum install yum-plugin-downloadonly | |
yum install --downloadonly <your-package-or-your-rpm> | |
find /var/cache/yum -iname '*.rpm' |
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 | |
# | |
# (1) copy to: ~/bin/ssh-colorize | |
# (2) set: alias ssh=~/bin/ssh-colorize | |
# (3) do: chmod +x ~/bin/ssh-colorize | |
# | |
# Forkd from https://gist.github.com/thomd/956095 | |
set_term_bgcolor(){ | |
local R=$1 |