diff --git a/deno/playbook.yaml b/deno/playbook.yaml index a62ba1d..6d3868b 100644 --- a/deno/playbook.yaml +++ b/deno/playbook.yaml @@ -61,6 +61,15 @@ name: sourcemap executable: pip3 state: present + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: Install pyodbc + apt: + pkg: + - python3-pyodbc + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 - name: Install requests become: true @@ -68,3 +77,12 @@ name: requests executable: pip3 state: present + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: Install requests + apt: + pkg: + - python3-requests + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 diff --git a/helper_mssql/playbook.yaml b/helper_mssql/playbook.yaml index ee9a90e..68adc42 100644 --- a/helper_mssql/playbook.yaml +++ b/helper_mssql/playbook.yaml @@ -29,6 +29,15 @@ become_user: codio pip: name: pyodbc + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: Install pyodbc + apt: + pkg: + - python3-pyodbc + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 - name: Creates directory become_user: codio diff --git a/helper_mysql/playbook.yaml b/helper_mysql/playbook.yaml index 30a59f1..0866c4d 100644 --- a/helper_mysql/playbook.yaml +++ b/helper_mysql/playbook.yaml @@ -25,7 +25,16 @@ - name: Install mysql-connector-python become_user: codio pip: - name: mysql-connector-python==8.2.0 + name: mysql-connector-python==26.7.0 + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: Install mysql-connector-python + apt: + pkg: + - python3-mysql.connector + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 - name: Creates directory become_user: codio diff --git a/helper_postgres/playbook.yaml b/helper_postgres/playbook.yaml index e5f3702..87dd673 100644 --- a/helper_postgres/playbook.yaml +++ b/helper_postgres/playbook.yaml @@ -33,6 +33,15 @@ become_user: codio pip: name: psycopg2 + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: Install psycopg2 + apt: + pkg: + - python3-psycopg2 + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 - name: Creates directory become_user: codio diff --git a/package_list.json b/package_list.json index 945fdcc..6cf4faa 100644 --- a/package_list.json +++ b/package_list.json @@ -202,7 +202,7 @@ "name": "R Studio", "description": "R is an open-source programming language and free environment that specializes in statistical computing and graphical representation. (Ubuntu 22.04 required)", "script": "r-studio", - "version": "2023.12.1", + "version": "2026.07.1-147", "category": "IDE" }, "jupyter-codio-extension": { diff --git a/python-lsp/playbook.yaml b/python-lsp/playbook.yaml index cdaf75d..2b6c181 100644 --- a/python-lsp/playbook.yaml +++ b/python-lsp/playbook.yaml @@ -26,8 +26,19 @@ update_cache: true when: ansible_facts['distribution_major_version'] | int >= 22 - name: install python-language-server for ubuntu >= 22 - pip: name=python-language-server version=0.36.2 + apt: + name: python3-pylsp + state: present + update_cache: true when: ansible_facts['distribution_major_version'] | int >= 22 - name: install pycodestyle pip: name=pycodestyle + when: ansible_facts['distribution_major_version'] | int < 22 + + - name: install pycodestyle for ubuntu >= 22 + apt: + name: pycodestyle + state: present + update_cache: true + when: ansible_facts['distribution_major_version'] | int >= 22 diff --git a/python2/playbook.yaml b/python2/playbook.yaml index 1dd1994..9341af8 100644 --- a/python2/playbook.yaml +++ b/python2/playbook.yaml @@ -3,6 +3,11 @@ become: yes become_user: root tasks: + - name: Fail if running on Ubuntu > 22.04 + fail: + msg: "These tasks should only be run on Ubuntu 22.04 or earlier" + when: ansible_distribution != "Ubuntu" or ansible_distribution_version is version('22.04', '>') + - apt: name=python state=present - apt: name=python-dev state=present - apt: name=python-pip state=present diff --git a/r-studio/playbook.yaml b/r-studio/playbook.yaml index e197efa..f966b59 100644 --- a/r-studio/playbook.yaml +++ b/r-studio/playbook.yaml @@ -3,10 +3,10 @@ become: yes become_user: root tasks: - - name: Fail if not running on Ubuntu 22.04 + - name: Fail if running on Ubuntu < 22.04 fail: - msg: "These tasks should only be run on Ubuntu 22.04" - when: ansible_distribution != "Ubuntu" or ansible_distribution_version != "22.04" + msg: "These tasks should only be run on Ubuntu 22.04 or later" + when: ansible_distribution != "Ubuntu" or ansible_distribution_version is version('22.04', '<') - name: Install essential packages ansible.builtin.apt: @@ -14,6 +14,9 @@ - build-essential - software-properties-common - dirmngr + - wget + - ca-certificates + - gnupg update_cache: true - name: Cpan apt key @@ -31,6 +34,41 @@ - name: Add CRAN Packages ansible.builtin.apt_repository: repo: ppa:c2d4u.team/c2d4u4.0+ + when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version('22.04', '==') + + # https://github.com/eddelbuettel/r2u + # https://eddelbuettel.github.io/r2u/ + + - name: Create temporary directory for R2U keys + ansible.builtin.file: + path: /tmp/r2ukeys + state: directory + mode: "0700" + when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version('26.04', '==') + + - name: Download R2U keys into temporary directory + ansible.builtin.shell: | + gpg --homedir /tmp/r2ukeys \ + --keyserver hkps://keyserver.ubuntu.com \ + --recv-keys A1489FE2AB99A21A 67C2D66C4B1D4339 51716619E084DAB9 + when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version('26.04', '==') + + - name: Export R2U keys + ansible.builtin.shell: | + gpg --homedir /tmp/r2ukeys --export | gpg --dearmor -o /usr/share/keyrings/r2u.gpg + when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version('26.04', '==') + + - name: Add R2U repository into sources list + ansible.builtin.copy: + dest: /etc/apt/sources.list.d/r2u.sources + content: | + Types: deb + URIs: https://r2u.stat.illinois.edu/ubuntu + Suites: resolute + Components: main + Arch: amd64, arm64 + Signed-By: /usr/share/keyrings/r2u.gpg + when: ansible_distribution == "Ubuntu" and ansible_distribution_version is version('26.04', '==') - name: Install R Base ansible.builtin.apt: @@ -39,7 +77,7 @@ - name: Install r studio .deb package ansible.builtin.apt: - deb: https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2026.01.0-392-amd64.deb + deb: https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2026.07.1-147-amd64.deb - name: Create systemd Rstudio config ansible.builtin.copy: diff --git a/tools/ansible.sh b/tools/ansible.sh old mode 100644 new mode 100755 index 9246573..3f06f8a --- a/tools/ansible.sh +++ b/tools/ansible.sh @@ -8,12 +8,61 @@ 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" ]; } 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 +114,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 @@ -83,7 +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 + if is_ubuntu_ge_22_04; then do_cmd sudo apt update do_cmd sudo apt install -y ansible else @@ -96,7 +149,7 @@ download_playbook do_cmd sudo apt-get update -if USE_PYTHON3 || IS_JAMMY; 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"