export_policy.sh 401 B

1234567891011121314
  1. #!/usr/bin/env bash
  2. set -e
  3. ssh-ident -V
  4. # Ref:
  5. # https://medium.com/@emachnic/using-policyfiles-with-chef-client-local-mode-4f47477b24db
  6. POLICY=${1:-"base"}
  7. rm -rf policy-export/*
  8. bundle exec chef-cli update "${POLICY}.rb"
  9. bundle exec chef-cli export "${POLICY}.rb" -a policy-export
  10. ln -svf "${POLICY}.rb" Policyfile.rb
  11. pushd policy-export > /dev/null
  12. tar xfz *.tgz && rm -rf *.tgz
  13. popd > /dev/null