From 739e96d7d817a7d477fd817277efeb3574e5637d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 9 Apr 2018 13:25:22 -0500 Subject: [PATCH 1/2] See https://github.com/jvonau/iiab/issues/18 --- scripts/ansible | 1 + scripts/ansible-2.4.x | 1 + scripts/ansible-2.5.x | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/ansible b/scripts/ansible index 1d60fbdf5..e25b099a4 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -38,6 +38,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ >> /etc/apt/sources.list.d/iiab-ansible.list diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index 4e8e74595..b8d0844e1 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -39,6 +39,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ # >> /etc/apt/sources.list.d/iiab-ansible.list diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index 38c31b64a..18708f73b 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -38,6 +38,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ # >> /etc/apt/sources.list.d/iiab-ansible.list From cc80573c2f8caa3ac5244a10b60f2f6e90d6e622 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 9 Apr 2018 15:06:52 -0500 Subject: [PATCH 2/2] make grep shutup if not found --- scripts/ansible | 2 +- scripts/ansible-2.4.x | 2 +- scripts/ansible-2.5.x | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index e25b099a4..52a27a25d 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -31,7 +31,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch apt-add-repository -y ppa:ansible/ansible #apt-add-repository -y ppa:ansible/ansible-2.4 diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index b8d0844e1..bebfd3f5b 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -32,7 +32,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch #apt-add-repository -y ppa:ansible/ansible apt-add-repository -y ppa:ansible/ansible-2.4 diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index 18708f73b..08a0741bb 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -31,7 +31,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch #apt-add-repository -y ppa:ansible/ansible apt-add-repository -y ppa:ansible/ansible-2.5