Update script to allow args

This commit is contained in:
Yosafat Marselino 2025-05-17 09:18:52 -04:00
parent a9e1a43b80
commit a69405c0cd
2 changed files with 37 additions and 2 deletions

View File

@ -26,7 +26,7 @@
- { name: 'script1.sh' }
- name: Execute downloaded scripts
shell: "/tmp/downloaded_scripts/{{ item.item.name }}"
shell: "/tmp/downloaded_scripts/{{ item.item.name }} --ip {{ 192.168.8.54 }}"
loop: "{{ downloaded_scripts.results }}"
register: script_output

View File

@ -12,8 +12,43 @@ if [ "$EUID" -ne 0 ]; then
fi
host_name="smolite"
usage() {
echo "Usage: $0 -i IP -a ACTION"
echo "Required arguments:"
echo " -i, --ip IP Specify the IP address"
echo " -a, --action ACTION Specify the action to perform"
echo "Optional arguments:"
echo " -h, --help Show this help message and exit"
exit 1
}
# read -p "Enter option (1.SMO Only; 2. NearRT Only; 3. SMO+NearRT ): " OPTION
read -p "Enter IP address: " VM_IP
#read -p "Enter IP address: " VM_IP
if [ $# -eq 0 ]; then
echo "Error: Arguments are required!"
usage
fi
while [ $# -gt 0 ]; do
case "$1" in
-h | --help)
usage
;;
-ip | --ip)
VM_IP="$2"
shift 2
;;
*)
echo "Error: Unknown option $1"
usage
;;
esac
done
echo "Provision Kubernetes With IP $VM_IP"
exit
KUBEVERSION="1.32.3-1.1"
HELMVERSION="3.14.2"