Declare vars on playbook

This commit is contained in:
Yosafat Marselino 2025-05-17 10:03:38 -04:00
parent 6076e31518
commit 0746f69628
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,10 @@
- name: Curl and execute scripts on target machine
hosts: target_hosts
become: yes # Use sudo if needed
vars:
script_params:
ip: "192.168.1.100"
prune: "false"
tasks:
- name: Convert params dictionary to command line arguments
set_fact:

View File

@ -41,7 +41,7 @@ while [ $# -gt 0 ]; do
shift 2
;;
-prune | --prune)
PRUNE=true
PRUNE="$2"
shift 2
;;
*)
@ -95,7 +95,7 @@ check_existing_cluster() {
if command_exists kubectl && kubectl cluster-info &>/dev/null; then
echo "Found existing installation"
echo "Proceed to clean em UP"
if [[ $PRUNE != true ]]; then
if [[ $PRUNE != "true" ]]; then
echo "Kubernetes cluster removal skipped. Exiting script."
exit 0
fi