Skip to content

Instantly share code, notes, and snippets.

View vinyar's full-sized avatar

Mr. Pacman vinyar

  • Launch Consulting
  • Seattle
View GitHub Profile
@vinyar
vinyar / DRBD LVM replication details
Last active August 29, 2015 14:23
DRBD lvm replication details
The scenario:
Customer is setting up DRBD chef server. They have 1 TB raid array, but only use around 2 GB of that
space for chef server. Our directions call out for setting up LVM at 80% of physical volume for bit
level replication.
Customer wanted to know if we can setup LVM for a much smaller chunk of the RAID so they can utilize
the rest of it for soemthing else, for example Nexus.
A:
@vinyar
vinyar / nodes.ps1
Created June 21, 2015 01:54
a powershell script to run through cookbooks migrated from chef server (10) and find the ones here metadata.rb cookbook names doesnt match folder name
############## identifying cookbooks where metadata does not match folder name
dir | %{$folder=$_.basename -replace '-\d{1,}.\d{1,}.\d{1,}'
$meta_name= (cat $_\metadata.rb|select-string "name ") -replace 'name {1,}' -replace "'"
if ($folder -ne $meta_name){write-host $folder}
}
dir role_chef_client_* | %{$_.basename -replace '-\d{1,}.\d{1,}.\d{1,}'}
dir role_chef_client_* | %{(cat $_\metadata.rb|select-string "name ") -replace 'name {1,}' -replace "'"}
### Method 1 ###
$ knife role from file roles/windows_web.rb \
--key .chef-test_user/test_user.pem \
--user test_user
Benefits:
* Uses standard knife subcomands
* Out of the box
Caveats:
* Requires the users private keys on the jenkins machine.
#!/opt/chef/embedded/bin/ruby
require 'json'
class Checker
def check
check_cookbook_metadata
check_node_sizes
check_bad_platform_metadata
check_bad_invitations
check_duplicates_in_groups
New-Alias s "C:\Program Files\Sublime Text 3\sublime_text.exe" -force
new-alias ll 'dir' -force
$MaximumHistoryCount = 500
{"ssl": {"verify": false}}
@vinyar
vinyar / waffle.io
Created June 25, 2015 18:06
waffle.io
waffle.io
can put kanban on top of github.
can also roll up multiple github repos.
can do milestones based on lables or tags.
chet/test-driven-infrastructure
seems like a much better way of capturing of exactly what we're working on.
@vinyar
vinyar / Bootstrapping chef client behind firewall
Created June 25, 2015 18:24
Bootstrapping chef client behind firewall
https://docs.chef.io/knife_bootstrap.html#custom-templates
https://docs.chef.io/install_bootstrap.html
https://docs.chef.io/knife_bootstrap.html
https://github.com/chef/chef/blob/12.2.1/lib/chef/knife/bootstrap/templates/chef-full.erb
https://github.com/chef/chef/blob/11.6.2/lib/chef/knife/bootstrap/chef-full.erb
Blog:
https://www.chef.io/blog/2014/10/28/working-with-chef-behind-your-firewall/
http://www.appneta.com/blog/customizing-chef-bootstrap-templates/
http://www.tomduffield.com/bootstrapping-without-the-internet/
@vinyar
vinyar / Cookbook dependency reverse lookup.rb
Last active September 5, 2015 21:31
cookbook reverse dependency lookup
Its a cookbook class that we use to abstract cookbooks and their
dependencies. The key method to look at is dependency_hash which creates
a hash based on the dependencies of the cookbook.
We do not explicitly do a reverse dependency lookup but we can use this
hash to infer a change in dependencies from a change in any cookbook in
an environment. So the flow is:
1. I change cookbook A and it gets sent to the chef server and indexed
in berks.
@vinyar
vinyar / output.rb
Created July 2, 2015 22:23
post bootstrap first run error - Error connecting to https://s3-external-1.amazonaws.com/opscode-platform-product
login as: chef
[email protected]'s password:
Last login: Tue Jun 2 10:54:38 2015 from 38.104.1.242
_______________
/ ___/ __/_ __/
/ (_ / _/ / /
\___/___/ /_/
_______ ___________
/ __/ _ \/ __/ __/ _ \
_\ \/ ___/ _// _// // /