Created
November 17, 2019 04:11
This is the Boostrap script for creating a chef server on Ubuntu 16.04+ versions
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_13.0.17-1_amd64.deb ]; then | |
echo "Downloading the Chef server package..." | |
wget -P /downloads https://packages.chef.io/files/stable/chef-server/13.0.17/ubuntu/18.04/chef-server-core_13.0.17-1_amd64.deb | |
fi | |
# install Chef server | |
if [ ! $(which chef-server-ctl) ]; then | |
echo "Installing Chef server..." | |
dpkg -i /downloads/chef-server-core_13.0.17-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 test@testcorp.com P@ssword --filename /drop/chefadmin.pem | |
chef-server-ctl org-create testcorp "Test Corp, Inc." --association_user chefadmin --filename testcorp-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