Skip to content

Instantly share code, notes, and snippets.

@kryptek
Forked from shostakovich/bootstrap.sh
Created October 7, 2017 15:55
Show Gist options
  • Save kryptek/db8252e19daa5e8f732cd8af1a67dbf0 to your computer and use it in GitHub Desktop.
Save kryptek/db8252e19daa5e8f732cd8af1a67dbf0 to your computer and use it in GitHub Desktop.
Chef Solo on Mac OS X - examples
#!/bin/sh
USERNAME=shostakovich
mkdir ~/tmp
cd ~/tmp
# Install GCC + Git
curl https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg > GCC-10.7-v2.pkg
sudo installer -pkg GCC-10.7-v2.pkg -target /
# Install chef
sudo gem install chef
# Prepare Directory for Homebrew
sudo mkdir /usr/local
sudo chown -R $USERNAME /usr/local
template "#{node['homedir']}/.vimrc" do
source "vimrc.erb"
owner node['user']
end
execute "set dock to be on left" do
command "defaults write com.apple.dock orientation -string left"
user node['user']
end
execute "relaunch dock" do
command "killall Dock"
end
{
"run_list": [
"recipe[main]",
"recipe[git]",
"recipe[rvm]",
"recipe[apps]"
],
"packages" : [
"wget",
"tmux",
"watch",
"mobile-shell",
"imagemagick",
"solr",
"mysql",
"aspell",
"htmldoc",
"ghostscript",
"redis",
"pdftohtml"
],
"homedir" : "/Users/shostakovich",
"user" : "shostakovich"
}
dmg_package "Google Chrome" do
dmg_name "googlechrome"
source "https://dl-ssl.google.com/chrome/mac/stable/GGRM/googlechrome.dmg"
action :install
end
zip_app_package "Mou" do
source "http://mouapp.com/download/Mou.zip"
end
dmg_package "Virtualbox" do
source "http://dlc.sun.com.edgesuite.net/virtualbox/4.1.18/VirtualBox-4.1.18-78361-OSX.dmg"
type "mpkg"
end
root_path = File.expand_path(File.join(File.dirname(__FILE__), '..'))
cookbook_path File.join(root_path, 'cookbooks')
json_attribs File.join(root_path, 'node.json')
# Move all the state stuff from /var/chef. I wish there was a single config
# variable for this!
state_root_path = File.expand_path('~/.chef/state')
file_cache_path "#{state_root_path}/cache"
checksum_path "#{state_root_path}/checksums"
sandbox_path "#{state_root_path}/sandbox"
file_backup_path "#{state_root_path}/backup"
cache_options[:path] = file_cache_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment