From e25eab3e784305cd77a9cf06047e8136cd5d8295 Mon Sep 17 00:00:00 2001 From: Adar Nimrod Date: Sat, 1 Jan 2022 11:46:17 +0200 Subject: [PATCH] Toolbx refresh. - Debian testing and the next Ubuntu LTS (jammy) have Toolbx packaged. Use that instead of the binary from toolbox-build. Keep a list of releases that don't have that it packaged since it should be pretty static and over time can be removed. - Instead of checking the distro release, check if there's a Kubic APT repo defined (like the assertion does). So we have a single place to list releases that need that repo. Since the current Debian stable (bullseye) and the next Ubuntu LTS (jammy) have Podman packaged that list should be very stable (unless there's another ElementaryOS release based on Ubuntu Focal before 7.0). - Rename Toolbox to Toolbx in task names (match the renamed project name). --- Ansible/roles/debian_server/tasks/toolbox.yml | 22 ++++++++++++------- Ansible/roles/debian_server/vars/main.yml | 20 +++++++++++++++-- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Ansible/roles/debian_server/tasks/toolbox.yml b/Ansible/roles/debian_server/tasks/toolbox.yml index 1a8b201..0133d2b 100644 --- a/Ansible/roles/debian_server/tasks/toolbox.yml +++ b/Ansible/roles/debian_server/tasks/toolbox.yml @@ -20,14 +20,8 @@ value: "1" - name: Install Podman from the Kubic repository - # yamllint disable-line rule:line-length - when: ansible_facts.distribution_release is in ["buster", "bionic", "focal", "hera", "odin"] + when: toolbox_podman_repo_base_url is defined block: - - name: Assertions - assert: - that: - - toolbox_podman_repo_base_url is defined - - name: Add the Podman repo key apt_key: state: present @@ -59,9 +53,21 @@ state: present update_cache: true -- name: Install Toolbox +- name: Install Toolbx from toolbox-build + # yamllint disable-line rule:line-length + when: ansible_facts.distribution_release is not in toolbox_distros_with_apt_package unarchive: dest: /usr/local/ remote_src: true # yamllint disable-line rule:line-length src: https://git.shore.co.il/shore/toolbox-build/-/jobs/artifacts/master/raw/toolbox.tar.gz?job=build + +- name: APT install Toolbx + # yamllint disable-line rule:line-length + when: ansible_facts.distribution_release is in toolbox_distros_with_apt_package + apt: + cache_valid_time: 3600 + name: + - podman-toolbox + state: present + update_cache: true diff --git a/Ansible/roles/debian_server/vars/main.yml b/Ansible/roles/debian_server/vars/main.yml index de0e88d..2ff2166 100644 --- a/Ansible/roles/debian_server/vars/main.yml +++ b/Ansible/roles/debian_server/vars/main.yml @@ -28,8 +28,12 @@ maintenance_tasks: command: mnpw --errors --warn -- needrestart -p frequency: daily -# Hera and Odin are ElementaryOS releases based on Ubuntu Bionic and Focal -# respectively. +# At the time of writing, the next versions of Debian and Ubuntu LTS (and thus +# the next version of ElementaryOS) have Podman and Toolbx packaged so the +# lists below should be pretty static and in time can be removed entirely. + +# Hera is an ElementaryOS release based on Ubuntu Bionic and Odin and Jólnir +# are ElementaryOS releases based on Ubuntu Focal. toolbox_podman_repo_base_url_mapping: # yamllint disable-line rule:line-length bionic: &bionic https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_18.04/ @@ -42,3 +46,15 @@ toolbox_podman_repo_base_url_mapping: toolbox_podman_repo_base_url: |- {{ toolbox_podman_repo_base_url_mapping[ansible_facts.distribution_release] }} + +toolbox_distros_without_apt_package: + # Debian releases before bookworm. + - bullseye + - buster + # Ubuntu releases before jammy. + - bionic + - focal + # ElementaryOS release before 7.0 (which is based on Ubuntu jammy). + - hera + - odin + - jolnir -- GitLab