setup, add option to run test.yml.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
LOCAL="$DIR/local.yml"
|
||||
TEST="$DIR/test.yml"
|
||||
URL="https://git.hyperling.com/me/env-ansible"
|
||||
if [[ -z $BRANCH ]]; then
|
||||
export BRANCH="main"
|
||||
@@ -31,7 +32,7 @@ branch=""
|
||||
function usage {
|
||||
cat <<- EOF
|
||||
|
||||
$PROG [-l] [-b branch_name] [-g] [-w] [-s] [-f] [-h]
|
||||
$PROG [-l | -t] [-b branch_name] [-g] [-w] [-s] [-f] [-h]
|
||||
Program to initialize synchronization with Hyperling's Ansible configuration.
|
||||
$URL
|
||||
|
||||
@@ -39,6 +40,7 @@ function usage {
|
||||
-l : Run the local playbook associated with this $PROG.
|
||||
This is helpful for development or just saving bandwidth.
|
||||
It also provides prettier colors than the plaintext from ansible-pull. ;)
|
||||
-t : Run the test playbook which has a much smaller set of includes.
|
||||
-b branch_name : Download and run a specific branch. Default is $BRANCH.
|
||||
-g : Enable the General config with test contents.
|
||||
-w : Enable the Workstation config with test contents.
|
||||
@@ -52,9 +54,10 @@ function usage {
|
||||
|
||||
## Parameter Parsing ##
|
||||
|
||||
while getopts ":lb:gwsfh" arg; do
|
||||
while getopts ":ltb:gwsfh" arg; do
|
||||
case $arg in
|
||||
l) local="Y" && echo "Running $LOCAL as the playbook." ;;
|
||||
t) test="Y" && echo "Running $TEST as the playbook." ;;
|
||||
b) branch="$OPTARG" && echo "Using branch $branch instead of $BRANCH." ;;
|
||||
g) create_general="Y" && echo "Generating test '$general_config'." ;;
|
||||
w) create_workstation="Y" && echo "Generating test '$workstation_config'." ;;
|
||||
@@ -232,7 +235,10 @@ echo " "
|
||||
|
||||
echo "Provisioning Ansible..."
|
||||
status=""
|
||||
if [[ "$local" == "Y" ]]; then
|
||||
if [[ "$test" == "Y" ]]; then
|
||||
sudo ansible-playbook $TEST
|
||||
status=$?
|
||||
elif [[ "$local" == "Y" ]]; then
|
||||
sudo ansible-playbook $LOCAL
|
||||
status=$?
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user