diff --git a/ansible/geninv.sh b/ansible/geninv.sh index b1692cc..9506a1a 100755 --- a/ansible/geninv.sh +++ b/ansible/geninv.sh @@ -25,6 +25,9 @@ declare -A groups while read type x hosts; do readarray -d, -t ips < <(printf "${hosts}") + + # Skip hosts that have an empty string + [[ "${hosts}" == "\"\"" ]] && continue if [[ "${type}" == *-* ]]; then groups[${type%%-*}]+=" ${type#*-} " diff --git a/ssh/genconf.sh b/ssh/genconf.sh index 7f34bc9..be674ea 100755 --- a/ssh/genconf.sh +++ b/ssh/genconf.sh @@ -39,6 +39,11 @@ EOF while read type x hosts; do [ -z "${hosts}" ] && continue + # Skip hosts that have an empty string + [[ "${hosts}" == "\"\"" ]] && continue + # Remove quotes from the hosts string + hosts=`echo $hosts | sed -s "s/^\(\(\"\(.*\)\"\)\|\('\(.*\)'\)\)\$/\\3\\5/g"` + readarray -d, -t ips < <(printf "${hosts}") for i in "${!ips[@]}"; do