#!/usr/bin/env bash set -e POLICY=${1:-"base"} echo -e "\n\e[4m\e[33mExporting policy:\e[0m \e[33m\e[1m${POLICY}\e[39m\e[0m" ssh-ident -V # Ref: # https://medium.com/@emachnic/using-policyfiles-with-chef-client-local-mode-4f47477b24db rm -rf policy-export/* echo -e "\e[32m" ln -svf "${POLICY}.rb" Policyfile.rb echo -en "\e[39m\e[0m" bundle exec chef-cli update "${POLICY}.rb" bundle exec chef-cli export "${POLICY}.rb" -f policy-export # pushd policy-export > /dev/null # tar xfz *.tgz && rm -rf *.tgz # popd > /dev/null