Skip to content

Instantly share code, notes, and snippets.

$foo = inline_template('<%= (1..100).to_a.join(" ")%>')
$foo2 = inline_template("<%= (1..100).to_a.each { | n | if n % 15 == 0 then 'fizzbuzz' elsif n % 5 == 0 then 'buzz' elsif n % 3 == 0 then 'fizz' else n end }%>")
notify {
"Fizzaaaa":
message => $foo,
}
$things = split($foo, ' ')
@nibalizer
nibalizer / webzone-puppet-stages-environements.science
Created June 10, 2012 17:34
environments instead of stages
Environments Instead of Stages
==============================
This WebZone post recommends (ab)using puppet environments to do bootstrap/staging.
-----------------------------------------------------------------------------------
Puppet stages is a pretty important idea. Its existence accepts the idea that configuration management is hard. Since configuration management is hard some advanced tools are needed. Advanced tools will likely not be installed by default so we need some concept of staging in order to get the system to a state where the advanced tool works properly.
The problem is Puppet stages come up short in a couple of places:
@nibalizer
nibalizer / fucking_fix_it.sh
Created August 31, 2012 09:01
Script to restore drbd after a premature shutdown on a ganeti node
#!/bin/bash
#Don't run random scripts from the internet
exit
#this is for when you've broken an ganeti node, its still onish, but drbd has stopped communicating
failed_node=$1
affected_nodes=`gnt-instance list -o name,snodes | grep $failed_node | cut -d " " -f 1 `
#drbdsetup /dev/drbd22 net 10.208.8.23:11176 10.208.8.21:11176 C -A discard-zero-changes -B consensus
port=13337 #be sure to make sure iptables isn't just blocking the drbd port range
@nibalizer
nibalizer / conf.colortail
Created August 31, 2012 11:52
colortail config for drbd
COLOR magenta
{
# matches the date
^(... ..).*$
^.*([0-9][0-9]\.[0-9]%).*$
}
COLOR cyan
{
^.*\[=*>(\.*)].*$
@nibalizer
nibalizer / myping.py
Created September 20, 2012 23:31
myping the thing to ping
#!/usr/bin/env python
import subprocess, commands
while True:
foo = commands.getoutput('ping -c 1 marine.cat.pdx.edu | grep "ms" | cut -d "=" -f 4')
# foo = sub.Popen("ping -c 1 marine.cat.pdx.edu")
# print foo
foo = foo.split(" ")[0]
#print "#"*int(float(foo)*100)
@nibalizer
nibalizer / get_ntp_servers.sh
Created September 24, 2012 16:53
script to get ntp servers from ntp.org
#!/usr/bin/zsh
link_base=http://support.ntp.org
relative_links=`curl http://support.ntp.org/bin/view/Servers/StratumOneTimeServers 2>/dev/null | grep Col1 | grep Servers | awk '{print $6}' | cut -d \" -f 2 | grep -v '<a' | grep -v nofollow`
for url_end in `echo "$relative_links" `
do
#echo "$link_base$url_end"
curl $link_base$url_end 2>/dev/null | grep -A1 Address | grep -v Address | tr '\n' ' ' | read v4 v6; #echo 4: $v4; echo 6: $v6
curl $link_base$url_end 2>/dev/null | grep -A1 CountryCode | grep -v CountryCode | tr '\n' ' ' | read countrycode ; #echo Country: $countrycode
@nibalizer
nibalizer / Nagios_externa-commands.pp
Created February 12, 2013 06:15
Puppet configs for a command enabled web interface
# the following is for enabling write access to the web gui
if $readonly_web == false {
file_line {.
'/etc/nagios3/nagios.cfg-external-commands-yes':
line => "check_external_commands=1",
path => '/etc/nagios3/nagios.cfg',
notify => Service['nagios3'],
require => Package['nagios3'];
'/etc/nagios3/cgi.cfg-all_service_commands':
@nibalizer
nibalizer / generic-linux.cf
Created February 14, 2013 20:38
generic-linux.cf
# handle null input (translate to <@> special case)
R$@ $@ <@>
# strip group: syntax (not inside angle brackets!) and trailing semicolon
R$* $: $1 <@> mark addresses
R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
R@ $* <@> $: @ $1 unmark @host:...
R$* [ IPv6 : $+ ] <@> $: $1 [ IPv6 : $2 ] unmark IPv6 addr
R$* :: $* <@> $: $1 :: $2 unmark node::addr
R:include: $* <@> $: :include: $1 unmark :include:...
@nibalizer
nibalizer / gist:6198564
Created August 10, 2013 01:14
what happens when you try to install rvm on solaris 10
[nibz@chandra ~]$ \curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 144 0 0:00:01 0:00:01 --:--:-- 1202
100 13784 100 13784 0 0 5390 0 0:00:02 0:00:02 --:--:-- 55136
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 100 124 0 0 317 0 --:--:-- --:--:-- --:--:-- 420
100 1081k 100 1081k 0 0 512k 0 0:00:02 0:00:02 --:--:-- 1367k
#!/bin/sh
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -ivh http://yum.puppetlabs.com/el/5/products/i386/puppetlabs-release-5-7.noarch.rpm
yum update
yum install puppet