Skip to content

Instantly share code, notes, and snippets.

before 'deploy:symlink' {
# copy config file to release_path
upload (source, #{release_path})
}
before 'deploy:symlink' do
# copy config file to release_path
upload (source, '#{release_path}')
end
role :counter do
enum_counter
end
task :enum_counter, :roles => [:puppet_masters] do
desc "Enumerate hosts that are counter servers from puppet DB"
hosts = Hash.new
cmd = 'sc_hosts.rb --class site::statcounter::profile::counter'
run cmd, :pty => true do |ch, stream, out|
next if out.chomp ==''
out.split("\r\n").each do |host|
namespace :deploy do
task :example do
puts ""
end
end
namespace :database do
task :configured? do
true if capture("/mysql/daemon.status/or/something?") =~ /OK/
[2012-04-28 00:00:00,599][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] creating index, cause [auto(index api)], shards [5]/[1], mappings []
[2012-04-28 00:00:00,871][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [syslog] (dynamic)
[2012-04-28 00:00:00,972][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [syslog] (dynamic)
[2012-04-28 00:00:02,070][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [log4j] (dynamic)
[2012-04-28 00:00:03,221][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [log4j] (dynamic)
[2012-04-28 00:00:03,551][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [apache-access] (dynamic)
[2012-04-28 00:00:03,614][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapping [apache-access] (dynamic)
[2012-04-28 00:00:24,759][INFO ][cluster.metadata ] [Silver] [logstash-2012.04.28] update_mapp
node default {
include
stdlib
hiera_include('classes')
$applications = hiera('applications', nil)
$resources = keys($applications)
---
resources:
app::core::instance:
- 01
- 07
- 10
app::sdp::instance:
- 02
module Puppet::Parser::Functions
newfunction(:hiera_create_resources, :type => :rvalue) do |*args|
if args[0].is_a?(Array)
args = args[0]
end
key = args[0] || nil
default = args[1] || nil
override = args[2] || nil
applications:
app::core::instance:
'01':
index: '01'
'02':
index: '02'
answer.each_key { |resource|
answer[resource].each_key { |instance|
function_create_resources(resource, answer[resource][instance])
}
}