Skip to content

Instantly share code, notes, and snippets.

@bijugs
bijugs / bach-env-sh-standard.md
Last active August 2, 2016 16:09
Standard for -env.sh

Goal

Define a standard for how configuration files similar to hadoop *-env.sh should be defined in chef-bach.

Requirement

  • Should be able to dynamically add/remove properties to the configuration file
  • Should be able to override default values defined in chef-bach through a wrapper cookbook
  • Should be able to conditionally add/remove properties to the configuration file

Proposal

# I'm not sure if this is a good approach as I've not been working heavily with chef recently.
# However this was an approach that we used to clear notifications from cookbooks when
# using wrapper cookbooks. (worked in Chef 11)
#
# There are now probably better approaches for writing re-usable cookbooks:
# http://www.slideshare.net/someara/cookbook-reusability-chef-community-summit-2014
## cookbook1::example.rb
@bijugs
bijugs / Chef-Partial-Search.md
Last active August 29, 2015 14:02
Partial search in Chef
# Sample Chef partial search functions.
# These chef library functions require "partial_search" cookbook.
# Upload "partial_searck" cookbook and then modify the metadata.rb file to 
# make "partial_search" cookbook as dependency.
#

#
# The following two functions will return the IP of the node running grahite and the port
# to which data can be send for storage.