This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slack "iptables-rules-changed-#{node.name}" do | |
message "iptables.sav was updated on #{node.name}! This should be investigated" | |
icon_url node['chef_client']['handler']['slack']['icon_url'] | |
channel node['chef_client']['handler']['slack']['channel'] | |
username "Chef iptables notifier" | |
action :nothing | |
end | |
template "/etc/iptables.sav" do | |
owner "root" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'eventmachine' | |
$done = false | |
module FdWatcher | |
def notify_readable | |
puts "readable event" | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
arch, os = RUBY_PLATFORM.split('-') | |
if os =~ /^darwin/ | |
SYS_poll = 230 # OSX 7 on linux x86_64, 168 on linux i386 | |
# /usr/include/sys/poll.h | |
# Requestable events. If poll(2) finds any of these set, they are | |
# copied to revents on return. | |
POLLIN = 0x0001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Author:: Joshua Timberman <[email protected]> | |
# Copyright:: Copyright (c) 2012, Joshua Timberman | |
# License:: Apache License, Version 2.0 | |
# | |
# Ohai Plugin: external_ipaddress | |
# | |
# Save this to /etc/chef/ohai_plugins/external_ipaddress.rb, then run ohai with: | |
# | |
# ohai -d /etc/chef/ohai_plugins external_ipaddress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
require 'chef/config' | |
require 'chef/search/query' | |
require 'chef/log' | |
require 'time' | |
require 'getoptlong' | |
require "ohai" | |
RET = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe "aws" | |
include_recipe "lvm" | |
include_recipe "xfs" | |
esvg = node.elasticsearch.ebs.lvm.volume_group | |
eslv = node.elasticsearch.ebs.lvm.logical_volume | |
Chef::Log.info "ElasticSearch: setting up 8 100G EBS volumes" | |
aws = data_bag_item("aws", node.app_environment) | |
8.times do |d| | |
disk = (d == 0 ? "/dev/sdi" : "/dev/sdi#{d}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'chef' | |
require 'chef/client' | |
require 'chef/run_context' | |
Chef::Config[:solo] = true | |
Chef::Config[:log_level] = :info | |
Chef::Log.level(:info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prototype mysql_grant provider for Chef | |
--------------------------------------- | |
Drop the two files into your mysql cookbook, and experiment with the following examples: | |
mysql_grant "kenneth" do | |
action :grant | |
username "root" # <- User with admin privs | |
password node[:mysql][:server_root_password] | |
# Actual grant details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'eventmachine' | |
EM.run do | |
SEKRET_SAUCE = EM.attach( | |
open(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null', 'w') | |
) | |
EM.start_server('0.0.0.0', 80, Module.new do | |
def post_init; proxy_incoming_to(SEKRET_SAUCE); end | |
end) | |
end |
NewerOlder