export_policy.sh 344 B

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