1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

'ansible --version' output was being truncated

This commit is contained in:
root 2021-04-13 12:14:27 -04:00
parent 5fba4fb3bf
commit 2ebf8aefc9
3 changed files with 12 additions and 5 deletions

View file

@ -89,9 +89,10 @@ CURR_ANSIBLE_VER=0
#if [[ `which ansible` ]]; then # "which" misses built-in commands like cd, and is RISKY per https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
#if [[ `type -P ansible` ]]; then # "type -P" isn't POSIX compliant; it misses built-in commands like "cd"
if [[ `command -v ansible` ]]; then # "command -v" is POSIX compliant; it catches built-in commands like "cd"
#CURR_ANSIBLE_VER=`ansible --version | head -1 | sed -e 's/.* //'`
#CURR_ANSIBLE_VER=`ansible --version | head -1 | cut -f 2 -d " "`
CURR_ANSIBLE_VER=`ansible --version | head -1 | awk '{print $2}'` # to match scripts/ansible
CURR_ANSIBLE_VER=$(ansible --version | head -1 | cut -f 2- -d " ")
# Above works with 'ansible [core 2.11.0rc2]' -- these old ways do not:
#CURR_ANSIBLE_VER=$(ansible --version | head -1 | awk '{print $2}')
#CURR_ANSIBLE_VER=$(ansible --version | head -1 | sed -e 's/.* //')
echo "Found Ansible ""$CURR_ANSIBLE_VER"
fi
if version_gt $MIN_ANSIBLE_VER $CURR_ANSIBLE_VER ; then