Skip to content

Instantly share code, notes, and snippets.

@bcarpio
bcarpio / fabric_mongodb_rolling_upgrade_.py
Created March 27, 2012 21:41
Fabric MongoDB Rolling Upgrade Task
@task
def rolling_upgrade(hostname):
""" Rolling upgrade of mongodb """
users.root()
conn = Connection('%s'%(hostname))
db = conn.admin
replSet = db.command("replSetGetStatus")
for secondary in replSet['members']:
stateStr = str(secondary['stateStr'])
host = str(secondary['name'])
-- mongod.py ---
@task
def rolling_upgrade():
""" Rolling upgrade of mongodb """
execute(puppet.puppetd_test)
--- puppet.py ---
$ulimit = $::hostname ? {
boxtypeA => "10000",
boxtypeB => "20000",
default => "1024",
}
@bcarpio
bcarpio / gist:2032220
Created March 13, 2012 22:27
Puppet Class Relationship Using New Relationship Syntax
manifests/site.pp:
import "classes/*.pp"
import "nodes/*.pp"
manifests/classes/base.pp
class base {
$role = regsubst($ec2_userdata, '.*role=(.*).*', '\1')
notify {"the role is: ${role}": }
Class['baseapps']<-Class['admin_users']
@bcarpio
bcarpio / mikoomi-mongodb-plugin.php
Created March 11, 2012 15:42
Working mikoomi-mongodb-plugin.php
<?php
/**********************************************************************
Mikoomi MIT License
**********************************************************************
Copyright (c) 2011 by Jayesh Thakrar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights