Skip to content

Instantly share code, notes, and snippets.

input {
amqp {
# AMQP connection details
host => "<%= amqpHost %>"
user => "<%= amqpUser %>"
vhost => "<%= amqpVhost %>"
password => "<%= amqpPassword %>"
# This name has to be same across indexer to have each indexer take only 1 message from the queue
name => "indexer_queue"
# Queue settings (needs to mirror all o
@jedi4ever
jedi4ever / sample.pp
Created June 11, 2012 15:43
hiera defines musings
define mymodule::party( $param1 , $param2
) {
}
With Hiera I can do
define mymodule::party( $param1 = hiera('param1','somedefault1') , $param2 = hiera('param2','somedefault2')
) {
}
@jedi4ever
jedi4ever / gist:2788325
Created May 25, 2012 14:06
Show changelog of what changed in mercurial repo + subrepos
def subrepo_changed?(from = 'tip~1',to = 'tip')
command = "hg status --rev #{from}:#{to} -m -a -r -d -S .hgsubstate"
result = `#{command}`.include?("M .hgsubstate")
return result
end
def subrepo_changes(from,to)
command = "hg diff -S -r #{from}..#{to} .hgsubstate"
result = `#{command}`
@jedi4ever
jedi4ever / gist:2726756
Created May 18, 2012 18:03
Strategy: Logic to determine if a commit (or series) has impact on a Puppet Role (class)

Problem:

Given a puppet tree (with manifest and modules) dir
When rspec-puppet tests and puppet lint tests pass Instead of re-running test on all possible roles I want to calculate what roles (classes) were impacted in between revision of the puppet tree

Roles would translate to classes in puppet tree with a special prefix f.i. role_

Usage

mynameis = File.read('identity').strip
Mccloud::Config.run do |config|
#############################################################
## ** Provider Section ** - list alls keys to be used
#############################################################
######
## Example Amazon provider
@jedi4ever
jedi4ever / gist:1864622
Created February 19, 2012 16:55
parallels sdk send keycodes
import sys
import prlsdkapi
if len(sys.argv) != 4:
print "Usage: parallels_send_keycode '<VM_NAME>' '<keyname>' '<press|release>'"
exit()
# Parse arguments
vm_name=sys.argv[1]
# Keycode to use
@jedi4ever
jedi4ever / rspec_test
Created February 14, 2012 18:28
question - rspec-puppet
I wonder if you can describe a test in rspec-puppet just to check if a certain host/name includes a class ?
I'm aware of define, function and class, but it seems host would be useful?
For one class like java you can write the test in the java class only but for multiple classes to cooperate it would be nice to check if a host always has some classes applied.
@jedi4ever
jedi4ever / gist:1758690
Created February 7, 2012 09:30
bind webui to cluster instead of specific address/host
# Change to <%= osUser %> user
# Elastich search connection string syntax - see https://logstash.jira.com/browse/LOGSTASH-134
exec setuidgid <%= osUser %> $JAVA_HOME/bin/java -Xmx<%= xmx %> -jar <%= installPrefix%>/logstash/logstash-monolithic.jar web --backend elasticsearch:///<%= esCluster %> -B <%= bindHost %>
@jedi4ever
jedi4ever / indexer
Created January 30, 2012 21:39
amqp input & output
input {
amqp {
# ship logs to the 'rawlogs' fanout queue.
type => "all"
debug => true
host => "33.33.33.10"
# Old syntax
# exchange_type => "fanout"
# New syntax
exchange => "rawlogs_exchange"
@jedi4ever
jedi4ever / gist:1704761
Created January 30, 2012 14:42
Puppet puzzle : parametrized classes - common logic
#First class = role web (calls logstash::common to setup directory structure)
class logstash::web(
$version = '1.1.0beta8'
) {
class {'logstash::common':
version => $version
}
}
#Second class = role shipper (calls logstash::common to setup directory structure)