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