Skip to content

Instantly share code, notes, and snippets.

@nicgrayson
nicgrayson / ohai.rb
Last active December 17, 2015 16:29
Trying to include a recipe that includes ohai::default
include_recipe "ohai"
def verify_cert_domain(cert_content,domain)
cert = OpenSSL::X509::Certificate.new(cert_content)
cert.subject.to_s.match("CN=#{domain}")
end
provider_config:
gce:
cli_command: "google server create"
mixins:
defaults:
provider: gce
google:
google-compute-machine: bc-ubuntu-1204-20130802-2033
security-groups:
execute "hdfs zkfc -formatZK" do
user "hdfs"
group "hdfs"
only_if { ::File.exists?("/etc/init.d/hadoop-hdfs-zkfc") }
not_if "/etc/init.d/hadoop-hdfs-zkfc status"
end
normal['nginx']['version'] = "1.4.1"
normal['nginx']['source']['version'] = "1.4.1"
normal['nginx']['source']['prefix'] = "/opt/nginx-#{node['nginx']['source']['version']}"
normal['nginx']['prefix'] = "/opt/nginx-#{node['nginx']['source']['version']}"
normal['nginx']['source']['sbin_path'] = "#{node['nginx']['source']['prefix']}/sbin/nginx"
normal['nginx']['source']['url'] = "http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz"
normal['nginx']['source']['modules'] = [
"http_ssl_module",
"http_gzip_static_module",
"headers_more_module",
@nicgrayson
nicgrayson / core-site.xml
Last active April 23, 2016 14:27
config files and logs for quorum based HA hadoop
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://vagrant-cluster</value>
</property>
<property>
require 'chefspec'
require 'berkshelf'
require 'fileutils'
Berkshelf.ui.mute!
berks = Berkshelf::Berksfile.from_file(File.expand_path('Berksfile'))
berks.install(path: "vendor/cookbooks", only: "external")
RSpec.configure do |c|
c.after(:suite) do
<%- node[:zookeeper][:servers].each do |n, s| %>
server.<%= n %>=<%= s + node[:zookeeper][:server_ports] %>
<%- end %>
xml = package "libxml2-dev" do
action :nothing
end
xml.run_action( :install )
xslt = package "libxslt1-dev" do
action :nothing
end
xslt.run_action( :install )
include_recipe "apt"
execute "perl -pi.orig -e 's/^(deb .* universe)$/$1 multiverse/' /etc/apt/sources.list"
apt_repository 'awstools' do
uri 'http://ppa.launchpad.net/awstools-dev/awstools/ubuntu'
distribution node['lsb']['codename']
components ['main']
keyserver 'keyserver.ubuntu.com'
key '40BBB133'