Skip to content

Instantly share code, notes, and snippets.

@bigfleet
Forked from jsierles/gist:75047
Created March 6, 2009 20:17
Show Gist options
  • Save bigfleet/75049 to your computer and use it in GitHub Desktop.
Save bigfleet/75049 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# EC2 bootstrap
#
mkdir /etc/chef
mkdir /var/chef
cat > /etc/chef/solo.rb <<SOLO
cookbook_path "/var/chef/cookbooks"
node_path "/var/chef/nodes"
log_level :info
file_store_path "/var/chef"
file_cache_path "/var/chef"
SOLO
cat > /etc/chef/bootstrap.json <<BOOTSTRAP
{"assigned_hostname": "<%= @hostname %>",
"assigned_domain": "<%= @domain %>",
"public_fqdn": "<%= @public_fqdn %>",
"role": "<%= @role %>",
"recipes": ["ec2"]
}
BOOTSTRAP
cat > /etc/chef/init.json <<INIT
{"role": "<%= @role %>",
"recipes": ["ddclient", "base", "chef::client"]
}
INIT
echo <%= @validation_token %> > /etc/chef/validation_token
cat > /etc/resolv.conf <<DNS
search <%= @domain %>
nameserver <%= @primary_nameserver_ip %>
DNS
wget -P /tmp http://dist/ruby-enterprise_1.8.6-20090201_i386.deb
dpkg -i /tmp/ruby-enterprise_1.8.6-20090201_i386.deb
gem sources -a http://gems
gem sources -a http://gems.opscode.com
gem install chef --no-rdoc --no-ri
chef-solo -j /etc/ec2/bootstrap.json -r https://chef/cookbooks.tgz
chef-solo -j /etc/ec2/init.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment