Created
May 6, 2012 16:09
-
-
Save ilude/2623112 to your computer and use it in GitHub Desktop.
Chef Solo Configuration steps and files
This file contains hidden or 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
mkdir -p ~/.ssh | |
cat > ~/.ssh/authorized_keys<<EOF | |
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAijGY3BBjONqbfTtgyPXS56Wb3w8+4BtMSvdf5L7gKI7FkeKSTNIBDkMfBT0yyslvwQZAuVVqiqV1elybUN45xgBj/Xrkzilg49WgRTRlo8wxjcZRbtMaoK0tAOHIFBBlxcAt/GAlvQOILOtLC0djEyJ2fbnFLUrZAdjqkFAz0RY/qsVU3MSA3PukcgzB/aj9VARD/dctoWSZW8C38IChRddMfayy7V0qLCUA9wZ5eZIRCE6LqTZyV3nDyPKl42H8O3DGoCEnfPaBdMema3QWcQ7dZ5UT8I4VO5dF0mvCN2dL81LeyqLlhvohM15YUPTfYXJudMHZNBq5SN2sLdjuTQ== [email protected] | |
EOF | |
sudo -i | |
# Apt-install various things necessary for Ruby, guest additions, | |
# etc., and remove optional things to trim down the machine. | |
apt-get -y update | |
#apt-get -y dist-upgrade | |
apt-get -y install linux-headers-$(uname -r) | |
apt-get -y install build-essential libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison git | |
# install ACPI support so we can shut the machine down without ssh | |
# added this to the preseed | |
apt-get -y install acpi-support | |
# Install Ruby from source in /opt so that users of Vagrant | |
# can install their own Rubies using packages or however. | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar xvzf ruby-1.9.3-p194.tar.gz | |
cd ruby-1.9.3-p194 | |
./configure | |
make | |
make install | |
cd .. | |
rm -rf ruby-1.9.3-p194 | |
# Update RubyGems | |
echo "Updating RubyGem System..." | |
/usr/local/bin/gem update --system --no-ri --no-rdoc | |
echo "Updating installed gems..." | |
/usr/local/bin/gem update -y --no-ri --no-rdoc | |
# Install Bundler & chef | |
echo "Installing Bundler and Chef..." | |
/usr/local/bin/gem install -y bundler chef --no-ri --no-rdoc | |
# setup chef directories | |
mkdir /etc/chef | |
mkdir /var/chef | |
mkdir /var/chef/cache | |
# clone cookbooks | |
git clone https://github.com/ilude/Cookbooks.git /var/chef/cookbooks | |
# create solo.rb file | |
cat > /etc/chef/solo.rb<<EOF | |
json_attribs "/etc/chef/node.json" | |
cookbook_path "/var/chef/cookbooks" | |
file_cache_path "/var/chef/cache" | |
EOF | |
cat > /etc/chef/node.json<<EOF | |
{ | |
"run_list": ["recipe[nginx]"] | |
} | |
EOF | |
# create chef-update command | |
cat > /usr/local/bin/chef-update<<EOF | |
#!/bin/bash | |
pushd /var/chef/cookbooks | |
git pull | |
popd | |
chef-solo | |
EOF | |
chmod +x /usr/local/bin/chef-update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment