From 6dfeefeaed49dfaafcdb70638800ff0d5d478875 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 27 Jun 2018 13:21:00 -0400 Subject: [PATCH 1/8] Update ansible --- scripts/ansible | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index d033c8f1d..e3b4044ed 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -1,11 +1,16 @@ #!/bin/bash -e -echo -e '\nATTEMPTING TO INSTALL THE LATEST (RELEASED VERSION OF) ANSIBLE.' -echo -e 'Ensure you'"'"'re online before running this! (/opt/iiab/iiab/scripts/ansible)' -echo -e 'INSTRUCTIONS: https://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch' -echo -e 'ALTERNATIVES: Consider scripts/ansible-2.5.x "slow food" instead.\n' +echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' -GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install). +echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' + +echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE:' +echo -e 'Ensure you'"'"'re online before running this (/opt/iiab/iiab/scripts/ansible)\n' + +echo -e 'ALTERNATIVES: Run scripts/ansible-2.5.x or scripts/ansible-2.6.x "sloww food".\n\n' + + +GOOD_VER="2.6.0" # Ansible version for OLPC XO laptops (pip install). # On other OS's we install/upgrade to THE latest (released version of) Ansible. CURR_VER="undefined" # below are unused for future use @@ -19,7 +24,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.0-1.el7.ans.noarch.rpm + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.6.0-1.el7.ans.noarch.rpm # elif [ -f /etc/fedora-release ]; then # CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` # URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml From 232891f82693bf38cc572abfd05c9ed96f705371 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 27 Jun 2018 13:22:15 -0400 Subject: [PATCH 2/8] Update ansible-2.5.x --- scripts/ansible-2.5.x | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index 3f4a3c3a4..d25923a7c 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -1,9 +1,14 @@ #!/bin/bash -e -echo -e '\nATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.5.x' -echo -e 'Ensure you'"'"'re online before running this! (/opt/iiab/iiab/scripts/ansible-2.5.x)' -echo -e 'INSTRUCTIONS: https://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch' -echo -e 'ALTERNATIVE: Consider scripts/ansible to keep up-to-date as Ansible evolves.\n' +echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' + +echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' + +echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.5.x:' +echo -e 'Ensure you'"'"'re online before running this (/opt/iiab/iiab/scripts/ansible-2.5.x)\n' + +echo -e 'ALTERNATIVES: Run scripts/ansible-2.6.x, or scripts/ansible for the latest.\n\n' + GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install). # On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.5.x From 58c40d9bb434cb4353aefec5bfc12548abdfabf2 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 27 Jun 2018 13:23:37 -0400 Subject: [PATCH 3/8] Create ansible-2.6.x --- scripts/ansible-2.6.x | 100 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 scripts/ansible-2.6.x diff --git a/scripts/ansible-2.6.x b/scripts/ansible-2.6.x new file mode 100644 index 000000000..a7228ccb9 --- /dev/null +++ b/scripts/ansible-2.6.x @@ -0,0 +1,100 @@ +#!/bin/bash -e + +echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' + +echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' + +echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.6.x:' +echo -e 'Ensure you'"'"'re online before running this (/opt/iiab/iiab/scripts/ansible-2.6.x)\n' + +echo -e 'ALTERNATIVES: Run scripts/ansible-2.5.x, or scripts/ansible for the latest.\n\n' + + +GOOD_VER="2.6.0" # Ansible version for OLPC XO laptops (pip install). + # On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.6.x +CURR_VER="undefined" +# below are unused for future use +# URL="NA" + +export DEBIAN_FRONTEND=noninteractive + +if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant; also catches built-in commands like "cd" + echo "Installing --- Please Wait" + if [ -f /etc/centos-release ]; then + yum -y install ca-certificates nss epel-release + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.6.0-1.el7.ans.noarch.rpm +# elif [ -f /etc/fedora-release ]; then +# CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` +# URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml +# dnf -y install ansible git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python +# dnf -y install python-pip python-setuptools python-wheel patch + elif [ -f /etc/olpc-release ]; then + yum -y install ca-certificates nss + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + 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 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.6 + # 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 + apt -y install dirmngr + #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ + # >> /etc/apt/sources.list.d/iiab-ansible.list + echo "deb http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu xenial main" \ + >> /etc/apt/sources.list.d/iiab-ansible.list + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 + fi + else + echo "WARN: Could not detect distro or distro unsupported" + exit 1 + fi +else + #CURR_VER=`ansible --version | head -n 1 | cut -f 2 -d " "` + CURR_VER=`ansible --version | head -1 | awk '{print $2}'` # to match iiab-install + echo "Currently installed Ansible version is: $CURR_VER" + echo -e "INTERNET-IN-A-BOX GENERALLY REQUIRES ANSIBLE VERSION: $GOOD_VER or higher\n" + if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then + echo "Please use your system's package manager (or pip if nec) to update Ansible." + exit 0 + elif [ -f /etc/olpc-release ]; then + echo "Please use pip package manager to update Ansible." + exit 0 + #fi + #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then + #echo "Ansible repo(s) found within /etc/apt/sources.list*" + echo -e 'MANUAL INTERVENTION URGED:\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.6/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.6.x -- AND REMOVE ALL SIMILAR LINES TO ENSURE ANSIBLE UPDATES CLEANLY -- then re-run this script.\n' + else + echo -e 'Upstream ansible source repo not found:\nPLEASE UNINSTALL ANSIBLE (run "apt purge ansible" or "pip uninstall ansible", depending how Ansible was originally installed) THEN RE-RUN THIS SCRIPT.' + exit 1 + fi +fi + +if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then + # Align IIAB with Ansible community's latest official release + echo "Using apt to check for updates, then install/upgrade ansible" + apt update + apt -y --allow-downgrades install ansible=2.6* + + # TEMPORARILY USE ANSIBLE 2.4.4 (REMOVE IT WITH "pip uninstall ansible") + #pip install ansible==2.4.4 + + # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 + #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" + #cd /tmp + #wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb + #apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb +fi + +# needed? +mkdir -p /etc/ansible/ +echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts From 01fa258c47b205454e13eb18669ca1a98d7364c2 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Jun 2018 14:37:06 -0400 Subject: [PATCH 4/8] scripts/ansible-2.6.x 644 -> 755 --- scripts/ansible-2.6.x | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/ansible-2.6.x diff --git a/scripts/ansible-2.6.x b/scripts/ansible-2.6.x old mode 100644 new mode 100755 From 4a6d40408290f5dff1d26018dc5523d3d39e5e5e Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Jun 2018 14:55:19 -0400 Subject: [PATCH 5/8] WARN operator: re-run apt-key if keyserver.ubuntu.com network/mirror fails --- scripts/ansible | 2 ++ scripts/ansible-2.5.x | 2 ++ scripts/ansible-2.6.x | 2 ++ 3 files changed, 6 insertions(+) diff --git a/scripts/ansible b/scripts/ansible index e3b4044ed..0bae4bb13 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -2,6 +2,8 @@ echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' +echo -e 'WARNING: repeatedly re-run "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367" if this part of the script fails due to network/mirror.\n' + echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE:' diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index d25923a7c..d982244f1 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -2,6 +2,8 @@ echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' +echo -e 'WARNING: repeatedly re-run "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367" if this part of the script fails due to network/mirror.\n' + echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.5.x:' diff --git a/scripts/ansible-2.6.x b/scripts/ansible-2.6.x index a7228ccb9..1c2c7f05a 100755 --- a/scripts/ansible-2.6.x +++ b/scripts/ansible-2.6.x @@ -2,6 +2,8 @@ echo -e '\n\nSTRONGLY RECOMMENDED PREREQUISITE: (1) remove all prior versions of Ansible using "apt purge ansible" and/or "pip uninstall ansible" and (2) clear out all lines containing ansible from /etc/apt/sources.list and /etc/apt/sources.list.d/*\n' +echo -e 'WARNING: repeatedly re-run "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367" if this part of the script fails due to network/mirror.\n' + echo -e 'COMPLETE INSTALL INSTRUCTIONS:\nhttps://github.com/iiab/iiab/wiki/IIAB-Installation#do-everything-from-scratch\n' echo -e 'NOW ATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.6.x:' From d45560d28dd0146adb4fd149f83198ed15caf379 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 28 Jun 2018 20:09:15 -0400 Subject: [PATCH 6/8] Update ansible --- scripts/ansible | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 0bae4bb13..c60d6306c 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -12,7 +12,7 @@ echo -e 'Ensure you'"'"'re online before running this (/opt/iiab/iiab/scripts/an echo -e 'ALTERNATIVES: Run scripts/ansible-2.5.x or scripts/ansible-2.6.x "sloww food".\n\n' -GOOD_VER="2.6.0" # Ansible version for OLPC XO laptops (pip install). +GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install). # On other OS's we install/upgrade to THE latest (released version of) Ansible. CURR_VER="undefined" # below are unused for future use @@ -26,7 +26,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.6.0-1.el7.ans.noarch.rpm + yum -y install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.5-1.el7.ans.noarch.rpm # elif [ -f /etc/fedora-release ]; then # CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` # URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml From c0dcb0a62cb9a5ce80fdd4f3c1a998e72af157b4 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 28 Jun 2018 20:09:52 -0400 Subject: [PATCH 7/8] Update ansible-2.5.x --- scripts/ansible-2.5.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index d982244f1..fbf613b36 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -26,7 +26,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.0-1.el7.ans.noarch.rpm + yum -y install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.5-1.el7.ans.noarch.rpm # elif [ -f /etc/fedora-release ]; then # CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` # URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml From 336afea29d90cbb317aa748bdbc85106b0280f02 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 28 Jun 2018 20:11:35 -0400 Subject: [PATCH 8/8] Update ansible-2.6.x --- scripts/ansible-2.6.x | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ansible-2.6.x b/scripts/ansible-2.6.x index 1c2c7f05a..4e6b99638 100755 --- a/scripts/ansible-2.6.x +++ b/scripts/ansible-2.6.x @@ -12,7 +12,7 @@ echo -e 'Ensure you'"'"'re online before running this (/opt/iiab/iiab/scripts/an echo -e 'ALTERNATIVES: Run scripts/ansible-2.5.x, or scripts/ansible for the latest.\n\n' -GOOD_VER="2.6.0" # Ansible version for OLPC XO laptops (pip install). +GOOD_VER="2.5.5" # Ansible version for OLPC XO laptops (pip install). # On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.6.x CURR_VER="undefined" # below are unused for future use @@ -26,7 +26,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.6.0-1.el7.ans.noarch.rpm + yum -y install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.5-1.el7.ans.noarch.rpm # elif [ -f /etc/fedora-release ]; then # CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` # URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml