From 850aedd8083ab97cd106ed8138715887e3ac8596 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 17:09:04 -0500 Subject: [PATCH 1/7] scripts/ansible: --force-with-deps -r collections.yml -p /usr/share/ansible/collections --- scripts/ansible | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index bfd02e073..4336fa1c1 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -95,12 +95,7 @@ $APT_PATH/apt -y --allow-downgrades install ansible-base \ # upgrade of collection and dependencies it pulls in. Note Ansible may support # upgrading all collections cleanly in future. See PR #2652 (links) & PR #2653 echo -e "\n\nIIAB requires these 3 Ansible Collections: (we upgrade them here if possible!)\n" -ansible-galaxy collection install --force-with-deps community.general -ansible-galaxy collection install --force-with-deps community.mysql -ansible-galaxy collection install --force-with-deps ansible.posix # For 3 below -# selinux WAS in /opt/iiab/iiab/roles/1-prep/tasks/main.yml -# sysctl in /opt/iiab/iiab/roles/2-common/tasks/main.yml -# synchronize in /opt/iiab/iiab-admin-console/roles/js-menu/tasks/main.yml +ansible-galaxy collection install --force-with-deps -r collections.yml -p /usr/share/ansible/collections echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n" mkdir -p /etc/ansible From bca8d56457c90a111701be74bc0832a410439c24 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 17:19:58 -0500 Subject: [PATCH 2/7] Create collections.yml (listing the Ansible Collections that IIAB requires) --- collections.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 collections.yml diff --git a/collections.yml b/collections.yml new file mode 100644 index 000000000..77c100ee3 --- /dev/null +++ b/collections.yml @@ -0,0 +1,13 @@ +# IIAB requires the Ansible Collections listed below. Explanations here: +# http://FAQ.IIAB.IO > "What is Ansible and what version should I use?" +# https://github.com/iiab/iiab/blob/master/scripts/ansible.md + +--- +collections: + - name: community.general + - name: community.mysql + - name: ansible.posix # 2020-11-28: For ~3 modules below... + +# selinux WAS in /opt/iiab/iiab/roles/1-prep/tasks/main.yml +# sysctl in /opt/iiab/iiab/roles/2-common/tasks/main.yml +# synchronize in /opt/iiab/iiab-admin-console/roles/js-menu/tasks/main.yml From 55f07071873e81f029802560fd8c1a9907bb39bb Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Nov 2020 22:39:00 +0000 Subject: [PATCH 3/7] scripts/ansible: Explain /usr/share/ansible/collections/ansible_collections --- scripts/ansible | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/ansible b/scripts/ansible index 4336fa1c1..81facc937 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -96,6 +96,10 @@ $APT_PATH/apt -y --allow-downgrades install ansible-base \ # upgrading all collections cleanly in future. See PR #2652 (links) & PR #2653 echo -e "\n\nIIAB requires these 3 Ansible Collections: (we upgrade them here if possible!)\n" ansible-galaxy collection install --force-with-deps -r collections.yml -p /usr/share/ansible/collections +# 2020-11-28: The ~3 Ansible Collections (~37MB) used by IIAB used to be here: +# /root/.ansible/collections/ansible_collections +# But going forward they'll be stored here: +# /usr/share/ansible/collections/ansible_collections echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n" mkdir -p /etc/ansible From 105bbdc0b9b02e453fba583dc1e8650662dec91f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 20:27:53 -0500 Subject: [PATCH 4/7] ansible-galaxy -r /opt/iiab/iiab/collections.yml --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 81facc937..d6a8ad263 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -95,7 +95,7 @@ $APT_PATH/apt -y --allow-downgrades install ansible-base \ # upgrade of collection and dependencies it pulls in. Note Ansible may support # upgrading all collections cleanly in future. See PR #2652 (links) & PR #2653 echo -e "\n\nIIAB requires these 3 Ansible Collections: (we upgrade them here if possible!)\n" -ansible-galaxy collection install --force-with-deps -r collections.yml -p /usr/share/ansible/collections +ansible-galaxy collection install --force-with-deps -r /opt/iiab/iiab/collections.yml -p /usr/share/ansible/collections # 2020-11-28: The ~3 Ansible Collections (~37MB) used by IIAB used to be here: # /root/.ansible/collections/ansible_collections # But going forward they'll be stored here: From f4b0adc1d6462a3af68178eb9d80f57bc767c424 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 20:41:18 -0500 Subject: [PATCH 5/7] Identify OS from /etc/os-release to avoid stumbling on Mint directory /etc/upstream-release (same as scripts/local_facts.fact) --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 261893cf3..f4d45d05c 100755 --- a/iiab-install +++ b/iiab-install @@ -8,7 +8,7 @@ INVENTORY=ansible_hosts IIAB_STATE_FILE=/etc/iiab/iiab_state.yml ARGS="" CWD=`pwd` -OS=`grep ^ID= /etc/*release|cut -d= -f2` +OS=`grep ^ID= /etc/os-release | cut -d= -f2` OS=${OS//\"/} MIN_RPI_KERN=4.19.97 # If using Raspbian, 'rpi-update' should no longer be nec -- please use Raspbian 2020-02-13 or higher: https://github.com/iiab/iiab/issues/1993 MIN_ANSIBLE_VER=2.8.11 # Ansible 2.8.3 and 2.8.6 have serious bugs, preventing their use with IIAB. From 5314234167def1093b592fa0a1cafe222742e724 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 20:55:20 -0500 Subject: [PATCH 6/7] scripts/ansible: Mention PRs #2647 #2652 #2653 #2655 --- scripts/ansible | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index d6a8ad263..64fb9cc0f 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -93,12 +93,12 @@ $APT_PATH/apt -y --allow-downgrades install ansible-base \ # (Re)running collection installs appears safe, with --force-with-deps to force # upgrade of collection and dependencies it pulls in. Note Ansible may support -# upgrading all collections cleanly in future. See PR #2652 (links) & PR #2653 -echo -e "\n\nIIAB requires these 3 Ansible Collections: (we upgrade them here if possible!)\n" +# upgrading all collections cleanly in future. See PRs #2647 #2652 #2653 #2655 +echo -e "\n\nIIAB requires these ~3 Ansible Collections: (we upgrade them here if possible!)\n" ansible-galaxy collection install --force-with-deps -r /opt/iiab/iiab/collections.yml -p /usr/share/ansible/collections -# 2020-11-28: The ~3 Ansible Collections (~37MB) used by IIAB used to be here: +# 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here: # /root/.ansible/collections/ansible_collections -# But going forward they'll be stored here: +# But going forward they'll be stored herein: # /usr/share/ansible/collections/ansible_collections echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n" From a3fc75d9ef8675522f7b84bc114af7d82d0871fc Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 28 Nov 2020 21:18:58 -0500 Subject: [PATCH 7/7] scripts/ansible: code readability --- scripts/ansible | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 64fb9cc0f..0bc127605 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -15,8 +15,8 @@ GOOD_VER="2.10.3" # Orig for 'yum install [rpm]' & XO laptops (pip install) # IIAB implementers might instead consider these 2 GENERAL TECHNIQUES below # ("in an emergency!") e.g. if you must install an older version of Ansible: -# TEMPORARILY USE ANSIBLE 2.9.13 (REMOVE IT WITH "pip uninstall ansible") -#pip install ansible==2.9.13 +# TEMPORARILY USE ANSIBLE 2.9.15 (REMOVE IT WITH "pip uninstall ansible") +#pip install ansible==2.9.15 # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. Details: iiab/iiab#669 #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" @@ -95,7 +95,9 @@ $APT_PATH/apt -y --allow-downgrades install ansible-base \ # upgrade of collection and dependencies it pulls in. Note Ansible may support # upgrading all collections cleanly in future. See PRs #2647 #2652 #2653 #2655 echo -e "\n\nIIAB requires these ~3 Ansible Collections: (we upgrade them here if possible!)\n" -ansible-galaxy collection install --force-with-deps -r /opt/iiab/iiab/collections.yml -p /usr/share/ansible/collections +ansible-galaxy collection install --force-with-deps \ + -r /opt/iiab/iiab/collections.yml \ + -p /usr/share/ansible/collections # 2020-11-28: The ~3 Ansible Collections used by IIAB (~37MB) once lived here: # /root/.ansible/collections/ansible_collections # But going forward they'll be stored herein: