For mass destruction (j/k I mean powerful data gathering)
-
Install Boto
-
Install GNU Parallel
For mass destruction (j/k I mean powerful data gathering)
Install Boto
Install GNU Parallel
Chef 11 introduces event dispatching mechanism, which emits event at different milestones in Chef run (aka lifecycle) , and users can add their custom handlers to hook into these events. Chef formatters already uses this API. For a complete list of currently available events check this
Following is a bare minimal example for adding a custom handler:
require 'chef/event_dispatch/base'
class Foo < Chef::EventDispatch::Base
# lets say hello world when chef run ends
def run_completed(node)
ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
# | |
# Author:: Christopher Peplin (<[email protected]>) | |
# Copyright:: Copyright (c) 2010 Bueda, Inc. | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
# In Chef, when a resource is defined all its variables are evaluated during | |
# compile time and the execution of the resource takes place in converge phase. | |
# So if the value of a particular attribute is changed in converge | |
# (and not in compile) the resource will be executed with the old value. | |
# Example problem: | |
# Let's consider this situation where there are two steps involved in a recipe | |
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed | |
# in converge phase | |
# Step 2 is a Chef resource that makes use of the node attribute that was |
GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.
[alias] | |
lg80 = "!git log --graph --color=always --abbrev-commit --date=relative --pretty=format:'%x00%h%x00%s%x00%cd%x00%an%x00%d' | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m %-50s \\033[32m%14s\\033[0m \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5, $6 }' | less -R" |
Works:
mkdir cookbooks
cd cookbooks/
git clone git://github.com/mlafeldt/ps2dev-cookbook.git ps2dev
git clone git://github.com/opscode-cookbooks/build-essential.git
git clone git://github.com/opscode-cookbooks/git.git
rspec .
class Chef | |
class Recipe | |
def skip_unsupported_platform | |
unless supported_platform? | |
Chef::Log.info("Unsupported platform #{node[:platform]} in #{cookbook_name}::#{recipe_name}, skipping recipe") | |
Chef::Log.debug("You said to skip unsupported platforms in #{cookbook_name}::#{recipe_name}") | |
Chef::Log.debug("and #{node['platform']} is unsupported by cookbook #{cookbook_name}. Update the cookbook's metadata") | |
Chef::Log.debug("if this is a supported platform, or remove #{cookbook_name}::#{recipe_name} from the node.") | |
end | |
end |
# cookbooks/keymaster/libraries/decrypt.rb | |
module Keymaster | |
module_function | |
def decrypt_data_bag_item(item) | |
Chef::Log.info("yeah !") | |
end | |
end | |
# cookbooks/whatever/metadata.rb |