Skip to content

Instantly share code, notes, and snippets.

View udondan's full-sized avatar
🤠

Daniel Schroeder udondan

🤠
View GitHub Profile
@udondan
udondan / ansible.cfg
Last active August 29, 2015 14:14
Cloned module fails
[defaults]
# we don't want no paramiko!
transport = ssh
forks = 50
gathering = smart
host_key_checking = true
timeout = 30
scp_if_ssh = true
import Cocoa
class MyModalWindowController: NSWindowController {
var mainW: NSWindow = NSWindow()
override init() {
super.init()
}
@udondan
udondan / iterable.py
Created March 16, 2015 10:42
Ansible filter plugin for testing if variables are iterable - available in Jinja2 but not in the version Ansible currently uses
from ansible import errors
from jinja2.filters import environmentfilter
class FilterModule(object):
def filters(self):
return {
'iterable': self.iterable
}
def iterable(*args):
try:
@udondan
udondan / commandContext.go
Last active May 3, 2018 07:45
os/exec CommandContext example
package main
import (
"context"
"os"
"os/exec"
"time"
)
func main() {
#!/bin/bash
CONTENT="$1"
# Create a random file name for tmp files
RAND=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32)
TMPFILE="/tmp/$RAND"
# Render content to tmp file and output content
echo -e "$CONTENT" > "$TMPFILE.in"
Green BG with black FG
(?i)(success(ful(ly)?)?|passing|passed|pass(?!word|phrase|wd))|done|(?<![a-z])ok(?![a-z])|(?<![^\s:])(?:1|2)\d{2}(?![^\s:])(?! (k(ilo)?|M(ega)?|G(iga)?|T(era)?|P(eta)?)(i)?B(yte|it)?)
Orange BG
(?i)warnings|warning|warn|rejected|(?<![^\s:])(?:3)\d{2}(?![^\s:])(?! (k(ilo)?|M(ega)?|G(iga)?|T(era)?|P(eta)?)(i)?B(yte|it)?)
Red BG
(?i)error(s)?|fail(s|ed(?!=0)|ure(s(?!: \[]))?)?(?![a-z])|exception(s(?!: \[]))?(?![a-z])|abort(ed)?|decline(d)?|denied|fatal|TODO|(?<![^\s:])(?:4|5)\d{2}(?![^\s:])(?! (k(ilo)?|M(ega)?|G(iga)?|T(era)?|P(eta)?)(i)?B(yte|it)?)
Orange BG (for Terraform)
@udondan
udondan / keybase.md
Created November 17, 2019 18:58
keybase.md

Keybase proof

I hereby claim:

  • I am udondan on github.
  • I am udondan (https://keybase.io/udondan) on keybase.
  • I have a public key ASByIy09-TGoshZYDjj9wd70hc68FgNlN4SQRfr3_FQecgo

To claim this, I am signing this object:

a4b:Approve*
a4b:Associate*
a4b:Create*
a4b:Delete*
a4b:Disassociate*
a4b:Forget*
a4b:Put*
a4b:Register*
a4b:Reject*
a4b:Revoke*
@udondan
udondan / cdk
Last active July 24, 2020 06:48
Disabling fancy AWS CDK output
#!/bin/bash
if [[ "$1" != "deploy" ]]; then
/usr/local/bin/cdk "$@"
exit
fi
CDK_LOG=$(mktemp)
tail -f "${CDK_LOG}" &
PID=$!
@udondan
udondan / include_vars_merged
Last active June 15, 2023 17:57
Ansible action plugin "include_vars_merged". Same as "include_vars" but merges hashes instead of overriding

Why?

Current version of Ansible (1.7.1) does not merge hashes in the include_vars task even if told so via hash_behaviour = merge in your ansible.cfg. ansible/ansible#9116

This action plugin will merge hashes no matter how you have configured your hash_behaviour.

How to setup:

Save include_vars_merged.py to library/plugins/action/include_vars_merged.py

Save include_vars_merged to library/custom/include_vars_merged