Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
#!/usr/bin/env bash | |
group_name="$1" | |
var_name="$2" | |
var_value="$3" | |
./create_dynamic_vars_db.py | |
sqlite3 dynamic_vars.db "INSERT OR REPLACE INTO group_vars ( group_name, var_name, var_value ) VALUES ( '${group_name}', '${var_name}', '${var_value}' );" |
#!/bin/sh | |
# | |
# About | |
# ----- | |
# This script sends simple system-metrics to a remote graphite server. | |
# | |
# | |
# Metrics | |
# ------- | |
# The metrics currently include the obvious things such as: |
New in Ansible 1.5, “Vault” is a feature of ansible that allows keeping sensitive data such as passwords or keys in encrypted files, rather than as plaintext in your playbooks or roles. These vault files can then be distributed or placed in source control. To enable this feature, a command line tool, ansible-vault is used to edit files, and a command line flag –ask-vault-pass or –vault-password-file is used. Alternately, you may specify the location of a password file or command Ansible to always prompt for the password in your ansible.cfg file. These options require no command line flag usage.
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
# Usage | |
# $ get_latest_release "creationix/nvm" | |
# v0.31.4 |
find -type f -size +3M -print0 | while IFS= read -r -d '' i; do | |
#echo $i | |
echo -n '.' | |
if grep -q "$i" md5-partial.txt; then | |
echo -n ':'; #-e "\n$i ---- Already counted, skipping."; | |
continue; | |
fi | |
#md5sum "$i" >> md5.txt | |
MD5=`dd bs=1M count=1 if="$i" status=none | md5sum` | |
MD5=`echo $MD5 | cut -d' ' -f1` |
#!/usr/bin/env bash | |
# consider if the server is passing a file like | |
while true; do nc -l 10000 <<<"hi"; done | |
# on our client side, we can consume this using nc | |
nc 10.0.0.1 10000 |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
def archive_to_bytes(archive): | |
def to_seconds(s): | |
SECONDS_IN_A = { | |
's': 1, | |
'm': 1 * 60, | |
'h': 1 * 60 * 60, |
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |