Skip to content

Instantly share code, notes, and snippets.

@saranjsr
Created April 20, 2018 14:57
Show Gist options
  • Save saranjsr/232e4ce3f7aa286415dcba48661d16bc to your computer and use it in GitHub Desktop.
Save saranjsr/232e4ce3f7aa286415dcba48661d16bc to your computer and use it in GitHub Desktop.
install chef 12.17.33 on ubuntu 16.04
#!/bin/bash
apt-get update
apt-get -y install curl
# download the Chef server package
if [ ! -f /tmp/chef-server-core_12.17.33_amd64.deb ]; then
echo "Downloading the Chef server package..."
wget -nv -P /tmp https://packages.chef.io/files/stable/chef-server/12.17.33/ubuntu/16.04/chef-server-core_12.17.33-1_amd64.deb
fi
# install Chef server
if [ ! $(which chef-server-ctl) ]; then
echo "Installing Chef server..."
dpkg -i /tmp/chef-server-core_12.17.33-1_amd64.deb
chef-server-ctl reconfigure
echo "Waiting for services..."
until (curl -D - http://localhost:8000/_status) | grep "200 OK"; do sleep 15s; done
while (curl http://localhost:8000/_status) | grep "fail"; do sleep 15s; done
echo "Creating initial user and organization..."
chef-server-ctl user-create admin admin admin [email protected] longpassword --filename admin.pem
chef-server-ctl org-create testorg "Organization" --association_user admin --filename admin-validator.pem
fi
echo "Your Chef server is ready!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment