Last active
November 26, 2017 21:48
-
-
Save ldesiqueira/3c19c8bd54a718f2e227e33a7fb9c32e to your computer and use it in GitHub Desktop.
desktop_to_chef_client
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
# Current Support | |
# Ubuntu 16.04.3 | |
if ! [ -f /usr/bin/curl ]; then | |
apt-get install curl -y | |
fi | |
if ! [ -f /usr/bin/git ]; then | |
apt-get install git -y | |
fi | |
PROVISIONING_COOKBOOK_NAME=chef-desktop | |
[email protected]:ldesiqueira/chef-desktop.git | |
CHEF_CLIENT_PATH=$(which chef-client) | |
CHEF_CLIENT_VERSION=13.2.20 | |
if ! [ -f $CHEF_CLIENT_PATH ]; then | |
GRABBED_CHEF_CLIENT_VERSION=$(chef-client -v|awk {'print $2'}) | |
if ! [ $GRABBED_CHEF_CLIENT_VERSION = $CHEF_CLIENT_VERSION ]; then | |
curl -LO https://omnitruck.chef.io/install.sh && bash ./install.sh -v $CHEF_CLIENT_VERSION && rm -rf install.sh | |
fi | |
fi | |
if ! [ -d /tmp/cookbooks ]; then | |
mkdir -p /tmp/cookbooks | |
fi | |
if [ -d /tmp/cookbooks ]; then | |
if [ -d /tmp/cookbooks/chef-desktop ]; then | |
rm -rf /tmp/cookbooks/chef-desktop | |
fi | |
cd /tmp/cookbooks && GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone $PROVISIONING_COOKBOOK_REPO_URL | |
cd /tmp/cookbooks && chef-client -z -o $PROVISIONING_COOKBOOK_NAME | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment