Add option to spit out facts.

This commit is contained in:
2025-10-30 15:37:33 -07:00
parent 4864ee3869
commit 8636a0e112

View File

@@ -20,7 +20,7 @@ server_config="$config_dir/server.ini"
function usage {
cat <<- EOF
$PROG [-l] [-b branch_name] [-g] [-w] [-s] [-h]
$PROG [-l] [-b branch_name] [-g] [-w] [-s] [-f] [-h]
Program to initialize synchronization with Hyperling's Ansible configuration.
$URL
@@ -32,7 +32,8 @@ function usage {
-g : Enable the General config with test contents.
-w : Enable the Workstation config with test contents.
-s : Enable the Server config with test contents.
-h : Display this help text
-f : Display this system's facts.
-h : Display this help text.
EOF
exit $1
@@ -40,13 +41,14 @@ function usage {
## Parameter Parsing ##
while getopts ":lb:gwsh" arg; do
while getopts ":lb:gwsfh" arg; do
case $arg in
l) local="Y" && echo "Running $LOCAL as the playbook." ;;
b) branch="$OPTARG" && echo "Using branch $branch instead of $BRANCH." ;;
g) create_general="Y" && echo "Requested '$general_config'." ;;
w) create_workstation="Y" && echo "Requested '$workstation_config'." ;;
s) create_server="Y" && echo "Requested '$server_config'." ;;
f) show_facts="Y" ;;
h) usage ;;
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
esac
@@ -125,6 +127,11 @@ if [[ `which ansible > /dev/null; echo $?` != 0 ]]; then
fi
echo "Installed!"
if [[ "$show_facts" == "Y" ]]; then
echo "Showing Ansible Facts"
ansible localhost -m setup --connection=local
fi
#echo "Adding Ansible Collections..."
#ansible-galaxy collection install community.general
#echo "Added!"