From 84cb4ec9ae8404e7f02b8a5c6f4b3b48403df668 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 1 Apr 2019 14:48:06 +1100 Subject: [PATCH] DCD-224: Add wrapper script to import environment vars from file. --- bin/ansible-with-atl-env | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/ansible-with-atl-env diff --git a/bin/ansible-with-atl-env b/bin/ansible-with-atl-env new file mode 100755 index 0000000..32fd8fa --- /dev/null +++ b/bin/ansible-with-atl-env @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +# Optionally take an environment file on the command-line for testing. +INV=${1:?"Inventory file must be specified"} +PLAYBOOK=${2:?"Playbook must be specified"} +ENV_FILE=${3:-"/etc/atl"} + +# Set the environment with default exports +set -a +source $ENV_FILE +set +a + +ansible-playbook -v -i $INV $PLAYBOOK +