From 1ec5e0e19088b158a5cb41b31f11ab7f0e439f2e Mon Sep 17 00:00:00 2001 From: Andrey Nikitin Date: Tue, 9 Jun 2026 14:26:04 +0100 Subject: [PATCH 1/2] prepare for ubuntu 26.04 --- tools/ansible.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/ansible.sh b/tools/ansible.sh index 9246573..14221cc 100644 --- a/tools/ansible.sh +++ b/tools/ansible.sh @@ -13,7 +13,8 @@ PY_FLAG=$1 IS_TRUSTY() { [ "${CODENAME}" == "trusty" ]; } IS_XENIAL() { [ "${CODENAME}" == "xenial" ]; } IS_BIONIC() { [ "${CODENAME}" == "bionic" ]; } -IS_JAMMY() { [ "${CODENAME}" == "jammy" ]; } +IS_JAMMY() { [ "${CODENAME}" == "jammy" ]; } # 22.04 +IS_RESOLUTE() { [ "${CODENAME}" == "resolute" ]; } # 26.04 USE_PYTHON3() { [ "${PY_FLAG}" == "python3" ]; } do_cmd() @@ -65,6 +66,10 @@ if IS_JAMMY; then ansible --version | grep -q '2.10' 2> /dev/null is_ansible_right=$? fi +if IS_RESOLUTE; then + ansible --version | grep -q '2.20' 2> /dev/null + is_ansible_right=$? +fi if [ $is_ansible_right -ne 0 ]; then do_cmd sudo apt-get update @@ -86,6 +91,10 @@ if [ $is_ansible_right -ne 0 ]; then if IS_JAMMY; then do_cmd sudo apt update do_cmd sudo apt install -y ansible + fi + if IS_RESOLUTE; then + do_cmd sudo apt update + do_cmd sudo apt install -y ansible else do_cmd sudo dpkg -i /tmp/ansible.deb do_cmd sudo rm /tmp/ansible.deb @@ -96,7 +105,7 @@ download_playbook do_cmd sudo apt-get update -if USE_PYTHON3 || IS_JAMMY; then +if USE_PYTHON3 || IS_JAMMY || IS_RESOLUTE; then sudo ansible-playbook -v "${COOKBOOK_PATH}/install_software-${BRANCH}/$0/playbook.yaml" -e 'ansible_python_interpreter=/usr/bin/python3' elif IS_TRUSTY; then sudo ansible-playbook -v "${COOKBOOK_PATH}/install_software-${BRANCH}/$0/playbook.yaml" From 843ff199967e677e24db061bf5b1adcf6fcfdad1 Mon Sep 17 00:00:00 2001 From: Andrey Nikitin Date: Mon, 13 Jul 2026 13:01:24 +0100 Subject: [PATCH 2/2] use python3 from ubuntu22 and upper. --- tools/ansible.sh | 56 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 6 deletions(-) mode change 100644 => 100755 tools/ansible.sh diff --git a/tools/ansible.sh b/tools/ansible.sh old mode 100644 new mode 100755 index 14221cc..3f06f8a --- a/tools/ansible.sh +++ b/tools/ansible.sh @@ -8,6 +8,54 @@ fi CODENAME=$(lsb_release -c -s) + +is_core() { + grep -qFx 'ID=ubuntu-core' /etc/os-release +} + +is_classic() { + ! is_core +} + +is_ubuntu_ge() { + is_classic && compare_ubuntu "${1:-}" "-ge" +} + +compare_ubuntu() { + VERSION=$1 + OPERAND=$2 + + if [ -z "$VERSION" ]; then + echo "os.query: version id is expected" + exit 1 + fi + + if ! grep -q 'ID=ubuntu' /etc/os-release; then + echo "os.query: comparing non ubuntu system" + return 1 + fi + + NUM_RE='^[0-9]+$' + NUM_VERSION="$(echo "$VERSION" | tr -d '".')" + if ! [[ $NUM_VERSION =~ $NUM_RE ]] ; then + echo "os.query: invalid version format \"$VERSION\" provided" + exit 1 + fi + + SYS_VERSION="$(grep 'VERSION_ID' /etc/os-release)" + SYS_VERSION="$(echo "${SYS_VERSION#*=}" | tr -d '".')" + if ! [[ $SYS_VERSION =~ $NUM_RE ]] ; then + echo "os.query: invalid version format \"$SYS_VERSION\" retrieved from system" + exit 1 + fi + + test "$SYS_VERSION" "$OPERAND" "$NUM_VERSION" +} + +is_ubuntu_ge_22_04() { + is_ubuntu_ge "22.04" +} + PY_FLAG=$1 IS_TRUSTY() { [ "${CODENAME}" == "trusty" ]; } @@ -88,11 +136,7 @@ if [ $is_ansible_right -ne 0 ]; then do_cmd sudo apt-get -y install wget python python-crypto python-yaml python-httplib2 python-setuptools python-markupsafe python-jinja2 python-paramiko sshpass do_cmd sudo wget -O /tmp/ansible.deb https://raw.githubusercontent.com/codio/install_software/${BRANCH}/tools/ansible_2.7.5-1ppa_bionic_all.deb fi - if IS_JAMMY; then - do_cmd sudo apt update - do_cmd sudo apt install -y ansible - fi - if IS_RESOLUTE; then + if is_ubuntu_ge_22_04; then do_cmd sudo apt update do_cmd sudo apt install -y ansible else @@ -105,7 +149,7 @@ download_playbook do_cmd sudo apt-get update -if USE_PYTHON3 || IS_JAMMY || IS_RESOLUTE; then +if USE_PYTHON3 || is_ubuntu_ge_22_04; then sudo ansible-playbook -v "${COOKBOOK_PATH}/install_software-${BRANCH}/$0/playbook.yaml" -e 'ansible_python_interpreter=/usr/bin/python3' elif IS_TRUSTY; then sudo ansible-playbook -v "${COOKBOOK_PATH}/install_software-${BRANCH}/$0/playbook.yaml"