Created
July 31, 2019 16:45
-
-
Save Bonifacio2/741faaafe5e07b90f8e4412cfbb13f30 to your computer and use it in GitHub Desktop.
This file contains 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/bash | |
apt-get update | |
apt-get -y install curl | |
# create staging directories | |
if [ ! -d /drop ]; then | |
mkdir /drop | |
fi | |
if [ ! -d /downloads ]; then | |
mkdir /downloads | |
fi | |
# download the Chef server package | |
if [ ! -f /downloads/chef-server-core_12.17.33_amd64.deb ]; then | |
echo "Downloading the Chef server package..." | |
wget -nv -P /downloads 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 /downloads/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 chefadmin Chef Admin admin@4thcoffee.com insecurepassword --filename /drop/chefadmin.pem | |
chef-server-ctl org-create 4thcoffee "Fourth Coffee, Inc." --association_user chefadmin --filename 4thcoffee-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