Created
September 13, 2012 17:14
-
-
Save jblaine/3715905 to your computer and use it in GitHub Desktop.
One-ish step RHEL6/CentOS6 Chef Server bootstrap.
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
#!/bin/sh | |
# | |
# One-ish step RHEL6/CentOS6 Chef Server bootstrap. Just a bunch | |
# of steps from the wiki encapsulated. | |
# | |
# http://wiki.opscode.com/display/chef/Installing+Chef+Server+using+Chef+Solo | |
# | |
# * Installs chef-server AND chef-webui. If you don't want the web UI, | |
# delete the '"webui_enabled": true' line in the code below. | |
# * Does not configure initial knife | |
# | |
# REQUIREMENTS: | |
# 1. You must have EPEL configured already. | |
# 2. For RHEL, that means the host also needs to be set up for the RH | |
# 'Optional' subscription channel. | |
# 3. If you are behind an HTTP proxy, uncomment and set it below if you | |
# do not already have it exported in your shell's environment. | |
# http_proxy=http://our.org:80 | |
echo "Installing chef-client and chef-solo..." | |
sudo true && curl -L http://opscode.com/chef/install.sh | sudo bash | |
chef-client -v > /dev/null 2>&1 | |
if [ $? -ne 0 ]; then | |
echo "Installation of chef-client and chef-solo failed." | |
exit 1 | |
fi | |
sudo mkdir /etc/chef | |
cat <<EOF>/etc/chef/solo.rb | |
file_cache_path "/tmp/chef-solo" | |
cookbook_path "/tmp/chef-solo/cookbooks" | |
EOF | |
echo "Configured basic /etc/chef/solo.rb" | |
cat <<EOF>$HOME/chef.json | |
{ | |
"chef_server": { | |
"server_url": "http://localhost:4000", | |
"webui_enabled": true | |
}, | |
"run_list": [ "recipe[chef-server::rubygems-install]" ] | |
} | |
EOF | |
echo "Stored temporary JSON in $HOME/chef.json" | |
echo "Running chef-solo...this could take many minutes..." | |
sudo chef-solo \ | |
-c /etc/chef/chef-solo.rb \ | |
-j ~/chef.json \ | |
-r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz | |
# For some reason, for me, these did not start automatically | |
# when the chef-solo run was complete above. So start them. | |
if [ $? -eq 0 ]; then | |
service chef-server start | |
service chef-webui start | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment