Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Created October 12, 2017 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infamousjoeg/0917ada024d4b1e3fac3731b42d23397 to your computer and use it in GitHub Desktop.
Save infamousjoeg/0917ada024d4b1e3fac3731b42d23397 to your computer and use it in GitHub Desktop.
Quickly install Chef Automate for development purposes
#!/bin/bash
apt-get update
apt-get -y install curl
chef_server_fqdn=$1
# create downloads directory
if [ ! -d /downloads ]; then
mkdir /downloads
fi
# download the Chef Automate package
if [ ! -f /downloads/automate_1.6.99-1_amd64.deb ]; then
echo "Downloading the Chef Automate package..."
wget -nv -P /downloads https://packages.chef.io/files/stable/automate/1.6.99/ubuntu/16.04/automate_1.6.99-1_amd64.deb
fi
# install Chef Automate
if [ ! $(which automate-ctl) ]; then
echo "Installing Chef Automate..."
dpkg -i /downloads/automate_1.6.99-1_amd64.deb
# run preflight check
automate-ctl preflight-check
# run setup
automate-ctl setup --license /tmp/automate.license --key /tmp/delivery.pem --server-url https://$chef_server_fqdn/organizations/4thcoffee --fqdn $(hostname) --enterprise default --configure --no-build-node
automate-ctl reconfigure
# wait for all services to come online
echo "Waiting for services..."
until (curl --insecure -D - https://localhost/api/_status) | grep "200 OK"; do sleep 1m && automate-ctl restart; done
while (curl --insecure https://localhost/api/_status) | grep "fail"; do sleep 15s; done
# create an initial user
echo "Creating delivery user..."
automate-ctl create-user default delivery --password insecurepassword --roles "admin"
fi
echo "Your Chef Automate server is ready!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment