Commit 233a67d3 authored by Mattia Rizzolo's avatar Mattia Rizzolo

deploy: use a real temporary directory

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent d49f9cc1
...@@ -7,7 +7,6 @@ DIR_PLAYBOOKS="playbooks" ...@@ -7,7 +7,6 @@ DIR_PLAYBOOKS="playbooks"
DIR_ENVIRONMENTS="envs" DIR_ENVIRONMENTS="envs"
DIR_ROLES="roles" DIR_ROLES="roles"
DIR_GROUP_VARS="group_vars" DIR_GROUP_VARS="group_vars"
DIR_TEMP=".deploy-ansible-home"
FILE_VAULT_PASSWORD="vault-password" FILE_VAULT_PASSWORD="vault-password"
...@@ -57,8 +56,10 @@ if [[ ! -f "${playbook_file}" ]]; then ...@@ -57,8 +56,10 @@ if [[ ! -f "${playbook_file}" ]]; then
fi fi
# Create the temporary working directory # Create the temporary working directory
rm -rf "${DIR_TEMP}" DIR_TEMP="$(mktemp -d -t deploy-ansible-home-XXXXXXX)"
mkdir -p "${DIR_TEMP}/play" function cleanup () { rm -rf "$DIR_TEMP"; }
mkdir -p "$DIR_TEMP/play"
trap cleanup EXIT
ln -s "`readlink -f "${DIR_ROLES}"`" "${DIR_TEMP}/play/roles" ln -s "`readlink -f "${DIR_ROLES}"`" "${DIR_TEMP}/play/roles"
ln -s "`readlink -f "${DIR_GROUP_VARS}"`" "${DIR_TEMP}/play/group_vars" ln -s "`readlink -f "${DIR_GROUP_VARS}"`" "${DIR_TEMP}/play/group_vars"
...@@ -77,6 +78,3 @@ fi ...@@ -77,6 +78,3 @@ fi
"${DIR_TEMP}/play/playbook.yml" \ "${DIR_TEMP}/play/playbook.yml" \
${vault_flags} \ ${vault_flags} \
|| true || true
# Remove temporary directory
rm -rf "${DIR_TEMP}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment