1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 11:12:06 +00:00

ansible-base (2.10) -> ansible-core (2.11+) transition very soon

This commit is contained in:
root 2021-04-18 14:12:26 -04:00
parent de234511b5
commit ead6a2375a
2 changed files with 29 additions and 23 deletions

View file

@ -8,8 +8,8 @@ addons:
- sourceline: ppa:ansible/ansible
packages:
# - python-pip # @arky had used this starting in 2018
- ansible-base # Install latest ansible-base e.g. 2.10.7+, similar to https://github.com/iiab/iiab/blob/master/scripts/ansible
# - python3-pymysql # These 7-or-8 packages are not needed during this very rapid --syntax-check
- ansible-core # MUCH FASTER pip3 OPTION IS BELOW. Conversely: apt (SLOW WAY) may be desired in future to mimic https://github.com/iiab/iiab/blob/master/scripts/ansible for linting etc?
# - python3-pymysql # These 7-or-8 packages are not needed during the very rapid --syntax-check (below)
# - python3-psycopg2
# - python3-passlib
# - python3-pip
@ -20,14 +20,13 @@ addons:
install:
# - scripts/ansible # See #2105: fails to install latest Ansible (& ~4 Ansible Collections from collections.yml) due to Travis VM's disk layout/perms being different
# - pip install ansible # SLOW/OVERWEIGHT: installs Ansible 3.0.0+ with ~80 Ansible Collections
# - pip install ansible-base # ALSO WORKS (FASTER THAN ALL ABOVE!) e.g. if the above addons: / apt: section is commented out. To install latest ansible-base e.g. 2.10.7+, similar to https://github.com/iiab/iiab/blob/master/scripts/ansible
# - pip3 install ansible-core # APRIL 2021: ansible-base is being renamed to ansible-core -- latest version number is listed at https://pypi.org/project/ansible-core/
# - pip3 install ansible # SLOW / OVERWEIGHT: installs Ansible 3.1.0+ superset, with more than 80 (far more than we need) Ansible Collections
# - pip3 install ansible-core # MUCH FASTER / MAY BE CONSIDERED IN FUTURE e.g. if above apt install of ansible-core is commented out. APRIL 2021: ansible-base (2.10) was renamed to ansible-core (2.11+) with the latest version number shown at https://pypi.org/project/ansible-core/
- ansible-galaxy collection install -r collections.yml # Install ~4 Ansible Collections
- "{ echo 'roles_path = ./roles/'; } >> ansible.cfg" # Add correct roles_path to ansible.cfg, appending to https://github.com/iiab/iiab/blob/master/ansible.cfg
# - "{ echo '[defaults]'; echo 'roles_path = ./roles/'; } >> ansible.cfg" # 2021-02-24: suddenly no longer works, with the newer ansible-base install methods above (error arises due to '[defaults]' appearing twice)
# - cat ansible.cfg # UNCOMMENT TO VERIFY!
- apt -a list ansible-base # VERIFY ansible-base VERSIONS OFFERED BY apt
- echo 'roles_path = ./roles/' >> ansible.cfg" # Add correct roles_path to ansible.cfg, appending to https://github.com/iiab/iiab/blob/master/ansible.cfg
# - "{ echo '[defaults]'; echo 'roles_path = ./roles/'; } >> ansible.cfg" # 2021-02-24: suddenly no longer works, with the newer ansible-base -> ansible-core install methods above (error arises due to '[defaults]' appearing twice)
- cat ansible.cfg # VISUAL VERIFICATION OF ABOVE!
- apt -a list ansible-core # VERIFY ansible-core VERSIONS OFFERED BY apt, from https://launchpad.net/~ansible/+archive/ubuntu/ansible
script:
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

View file

@ -9,9 +9,9 @@
APT_PATH=/usr/bin # Avoids problematic /usr/local/bin/apt on Linux Mint
CURR_VER=undefined # Ansible version you currently have installed
GOOD_VER=2.10.8 # Orig for 'yum install [rpm]' & XO laptops (pip install)
GOOD_VER=2.11.0 # Orig for 'yum install [rpm]' & XO laptops (pip install)
# We install the latest 'ansible-base' from PPA, using an OS 'CODENAME' below:
# We install the latest 'ansible-core' from PPA, using an OS 'CODENAME' below:
# https://launchpad.net/~ansible/+archive/ubuntu/ansible
# 'lsb_release -sc' gives Mint 20 codename 'ulyana' etc: (TOO FINE-GRAINED)
@ -21,17 +21,23 @@ else
CODENAME=focal # Debian 11+, RaspiOS 11+, Ubuntu 20.04+, Mint 20+ (ETC)
fi
# 'ansible-base' being renamed 'ansible-code' early in 2021. RELEASE LINK REFS:
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-base/
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.10
# https://github.com/ansible/ansible/commits/stable-2.10/changelogs/CHANGELOG-v2.10.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_11.rst
# APRIL 2021 - ansible-base (2.10) is being renamed to ansible-core (2.11+):
# https://www.ansible.com/blog/ansible-3.0.0-qa
# https://github.com/ansible/ansible/releases
# https://pypi.org/project/ansible-base/
# https://pypi.org/project/ansible-core/
# https://releases.ansible.com/ansible-base/
# https://releases.ansible.com/ansible-core/
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.10
# https://launchpad.net/~ansible/+archive/ubuntu/ansible-2.11 ?
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-base/
# http://ppa.launchpad.net/ansible/ansible/ubuntu/pool/main/a/ansible-core/ ?
# https://github.com/ansible/ansible/blob/stable-2.10/changelogs/CHANGELOG-v2.10.rst
# https://github.com/ansible/ansible/blob/stable-2.11/changelogs/CHANGELOG-v2.11.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_10.rst
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_11.rst
# FYI .travis.yml installs ansible-base in a slightly different way (PR #2689).
# FYI .travis.yml installs ansible-core in a slightly different way (PR #2689).
# IIAB implementers might instead consider these 4 GENERAL TECHNIQUES below
# ("in an emergency!") e.g. if apt fails & you need a newer/older Ansible:
@ -65,6 +71,7 @@ echo -e "\n\nYOU ARE RUNNING: /opt/iiab/iiab/scripts/ansible (TO INSTALL ANSIBLE
echo -e "RECOMMENDED PREREQUISITES:"
echo -e "(1) Verify you're online"
echo -e "(2) Remove all prior versions of Ansible using..."
echo -e " 'apt purge ansible-core' and/or 'pip3 uninstall ansible-core' and/or"
echo -e " 'apt purge ansible-base' and/or 'pip3 uninstall ansible-base' and/or"
echo -e " 'apt purge ansible' and/or 'pip uninstall ansible'"
echo -e "(3) Remove all lines containing 'ansible' from..."
@ -82,7 +89,7 @@ if [ $(command -v ansible) ]; then # "command -v" is POSIX compliant; also ca
else
echo -e "ANSIBLE NOT FOUND ON THIS COMPUTER -- LET'S TRY TO INSTALL IT!"
fi
echo -e "(Internet-in-a-Box requests ansible-base $GOOD_VER or higher)\n"
echo -e "(Internet-in-a-Box requests ansible-core $GOOD_VER or higher)\n"
# Code above designed to work on all Linux distributions, to preserve options,
# in support of any volunteer(s) wanting to port IIAB to a new Linux/distro.
@ -118,10 +125,10 @@ echo -e "IF *OTHER* ANSIBLE SOURCES APPEAR BELOW, PLEASE MANUALLY REMOVE THEM TO
echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
echo -e "\napt update; apt install ansible-base and python3 dependencies explained at:"
echo -e "\napt update; apt install ansible-core and python3 dependencies explained at:"
echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
$APT_PATH/apt update
$APT_PATH/apt -y --allow-downgrades install ansible-base \
$APT_PATH/apt -y --allow-downgrades install ansible-core \
python3-pymysql python3-psycopg2 python3-passlib python3-pip \
python3-setuptools python3-packaging python3-venv virtualenv
@ -140,7 +147,7 @@ ansible-galaxy collection install --force-with-deps \
# /usr/share/ansible/collections/ansible_collections
echo -e "\n\nCreating/verifying directory /etc/ansible & installing /etc/ansible/hosts\n"
mkdir -p /etc/ansible
echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts
mkdir -p /etc/ansible # LIKELY REDUNDANT, due to above installation of Ansible
echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts # LIKELY REDUNDANT, due to https://github.com/iiab/iiab/blob/master/ansible_hosts
echo -e "SUCCESS: VERIFY ANSIBLE WITH 'ansible --version' & 'apt -a list ansible-base'\n\n"
echo -e "SUCCESS: VERIFY ANSIBLE WITH 'ansible --version' & 'apt -a list ansible-core'\n\n"