summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-05-10 00:19:23 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-05-10 00:19:23 +0200
commit6abc58229f057a63e1799c834538d5fb139c6e22 (patch)
tree80c6639e569e2e83640d7fcce5b39d258aa6dd06
parentmake debian/ubuntu os release compare script much more generic (diff)
migrate all os release comparisons to use new filter
-rw-r--r--inventory/host_vars/ele-media.yml2
-rw-r--r--roles/apt-repo/backports/defaults/main.yml2
-rw-r--r--roles/apt-repo/base/defaults/main.yml2
-rw-r--r--roles/apt-repo/blackmagic/tasks/main.yml4
-rw-r--r--roles/core/base/tasks/Debian.yml3
-rw-r--r--roles/core/cpu-microcode/tasks/Debian.yml2
-rw-r--r--roles/core/ntp/tasks/Debian_systemd-timesyncd.yml3
-rw-r--r--roles/docker/engine/tasks/main.yml2
-rw-r--r--roles/elevate/media/tasks/main.yml6
-rw-r--r--roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_smartmon.yml3
-rw-r--r--roles/network/wireguard/base/tasks/main.yml6
-rw-r--r--roles/prepare-dkms/tasks/raspberrypi.yml4
-rw-r--r--roles/ws/base/tasks/main.yml6
-rw-r--r--roles/x509/acmetool/base/tasks/main.yml3
14 files changed, 29 insertions, 19 deletions
diff --git a/inventory/host_vars/ele-media.yml b/inventory/host_vars/ele-media.yml
index 95a60144..741b73bb 100644
--- a/inventory/host_vars/ele-media.yml
+++ b/inventory/host_vars/ele-media.yml
@@ -133,7 +133,7 @@ elevate_media_nextcloud_storage:
elevate_media_nextcloud_instance_name: media.elev8.at
elevate_media_nextcloud_instance:
- version: 28.0.3
+ version: 28.0.4
port: 8100
hostnames:
- media.elev8.at
diff --git a/roles/apt-repo/backports/defaults/main.yml b/roles/apt-repo/backports/defaults/main.yml
index 83aae81a..2d44e282 100644
--- a/roles/apt-repo/backports/defaults/main.yml
+++ b/roles/apt-repo/backports/defaults/main.yml
@@ -10,4 +10,4 @@ apt_repo_backports_components:
ubuntu:
- main
- universe
- debian: "{{ ((ansible_distribution_major_version | int) <= 11) | ternary(_apt_repo_backports_components_debian_.until_bullseye, _apt_repo_backports_components_debian_.after_bullseye) }}"
+ debian: "{{ (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<=', 'bullseye'))) | ternary(_apt_repo_base_components_debian_.until_bullseye, _apt_repo_base_components_debian_.after_bullseye) }}"
diff --git a/roles/apt-repo/base/defaults/main.yml b/roles/apt-repo/base/defaults/main.yml
index e7e48029..51585b41 100644
--- a/roles/apt-repo/base/defaults/main.yml
+++ b/roles/apt-repo/base/defaults/main.yml
@@ -10,7 +10,7 @@ apt_repo_base_components:
ubuntu:
- main
- universe
- debian: "{{ (ansible_distribution_release | debian_release_compare('<=', 'bullseye')) | ternary(_apt_repo_base_components_debian_.until_bullseye, _apt_repo_base_components_debian_.after_bullseye) }}"
+ debian: "{{ (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<=', 'bullseye'))) | ternary(_apt_repo_base_components_debian_.until_bullseye, _apt_repo_base_components_debian_.after_bullseye) }}"
raspbian:
- main
- rpi
diff --git a/roles/apt-repo/blackmagic/tasks/main.yml b/roles/apt-repo/blackmagic/tasks/main.yml
index 219b83e3..e376fe9f 100644
--- a/roles/apt-repo/blackmagic/tasks/main.yml
+++ b/roles/apt-repo/blackmagic/tasks/main.yml
@@ -18,7 +18,7 @@
- name: configure repo authentication
when:
- ansible_distribution == "Debian"
- - (ansible_distribution_major_version | int) < 10
+ - (ansible_distribution_release | debian_release_compare('<', 'buster'))
lineinfile:
path: /etc/apt/auth.conf
regexp: "^machine build.spreadspace.org "
@@ -29,7 +29,7 @@
- name: configure repo authentication
when: (ansible_distribution == "Ubuntu") or
- (ansible_distribution == "Debian" and (ansible_distribution_major_version | int) >= 10)
+ (ansible_distribution == "Debian" and (ansible_distribution_release | debian_release_compare('>=', 'buster')))
block:
- name: remove old repo authentication
lineinfile:
diff --git a/roles/core/base/tasks/Debian.yml b/roles/core/base/tasks/Debian.yml
index a735bcc7..4d2abc17 100644
--- a/roles/core/base/tasks/Debian.yml
+++ b/roles/core/base/tasks/Debian.yml
@@ -48,7 +48,8 @@
## TODO: install dool on newer systems... or all of them. From which package source??
- name: install dstat for older systems only
- when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<=', 'bookworm'))) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | debian_release_compare('<', 'noble')))
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<', 'trixie'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<', 'noble')))
apt:
name: dstat
state: present
diff --git a/roles/core/cpu-microcode/tasks/Debian.yml b/roles/core/cpu-microcode/tasks/Debian.yml
index 01fdd8b0..6c37098c 100644
--- a/roles/core/cpu-microcode/tasks/Debian.yml
+++ b/roles/core/cpu-microcode/tasks/Debian.yml
@@ -2,7 +2,7 @@
- name: check if non-free and contrib apt component is enabled for debian
when:
- 'ansible_distribution == "Debian"'
- - '(ansible_distribution_major_version | int) <= 11'
+ - '(ansible_distribution_release| debian_release_compare("<=", "bullseye"))'
- 'ansible_architecture in ["i386", "x86_64"]'
assert:
msg: "On Debian microcode-update packages are in non-free - please enable it (and contrib) using 'apt_repo_components'"
diff --git a/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
index 40c6629e..5fa60510 100644
--- a/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
+++ b/roles/core/ntp/tasks/Debian_systemd-timesyncd.yml
@@ -7,7 +7,8 @@
msg: "systemd-timesyncd can not be used as a NTP server or sync to local clocks"
- name: install systemd-timesyncd
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) > 10) or (ansible_distribution == 'Ubuntu')
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('>', 'buster'))) or
+ (ansible_distribution == 'Ubuntu')
apt:
name: systemd-timesyncd
state: present
diff --git a/roles/docker/engine/tasks/main.yml b/roles/docker/engine/tasks/main.yml
index cf879631..f61f8181 100644
--- a/roles/docker/engine/tasks/main.yml
+++ b/roles/docker/engine/tasks/main.yml
@@ -58,7 +58,7 @@
## TODO: for now this is only needed on Debian Bullseye and beyond
- name: install apparmor
when:
- - ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) >= 11
+ - ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('>=', 'bullseye'))
apt:
name: apparmor
state: present
diff --git a/roles/elevate/media/tasks/main.yml b/roles/elevate/media/tasks/main.yml
index 58743fef..882e9639 100644
--- a/roles/elevate/media/tasks/main.yml
+++ b/roles/elevate/media/tasks/main.yml
@@ -6,7 +6,8 @@
import_tasks: nextcloud.yml
- name: install exfat and ntfs packages for legacy installs
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 22)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<','bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<','jammy')))
apt:
name:
- exfat-fuse
@@ -15,7 +16,8 @@
state: present
- name: install exfat and ntfs packages for new installs
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) >= 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) >= 22)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('>=', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('>=', 'jammy')))
apt:
name:
- exfatprogs
diff --git a/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_smartmon.yml b/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_smartmon.yml
index 8da763cd..4825e552 100644
--- a/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_smartmon.yml
+++ b/roles/monitoring/prometheus/exporter/node/tasks/textfile_collector_smartmon.yml
@@ -5,7 +5,8 @@
state: present
- name: make sure smartd service is stopped and masked
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 20)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<', 'focal')))
systemd:
name: smartd.service
state: stopped
diff --git a/roles/network/wireguard/base/tasks/main.yml b/roles/network/wireguard/base/tasks/main.yml
index f096801c..da8a3861 100644
--- a/roles/network/wireguard/base/tasks/main.yml
+++ b/roles/network/wireguard/base/tasks/main.yml
@@ -1,11 +1,13 @@
---
- name: enable spreadspace repo
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 20)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<', 'focal')))
import_role:
name: apt-repo/spreadspace
- name: install wireguard modules via dkms (legacy systems only)
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 22)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<', 'jammy')))
block:
- name: install dkms
import_role:
diff --git a/roles/prepare-dkms/tasks/raspberrypi.yml b/roles/prepare-dkms/tasks/raspberrypi.yml
index 9ece31bf..1b6f1a53 100644
--- a/roles/prepare-dkms/tasks/raspberrypi.yml
+++ b/roles/prepare-dkms/tasks/raspberrypi.yml
@@ -1,13 +1,13 @@
---
- name: install legacy raspberry kernel-headers
- when: (ansible_distribution_major_version | int) <= 11
+ when: (ansible_distribution_release | debian_release_compare('<=', 'bullseye'))
apt:
name:
- raspberrypi-kernel-headers
- dkms
state: present
-- when: (ansible_distribution_major_version | int) > 11
+- when: (ansible_distribution_release | debian_release_compare('>', 'bullseye'))
block:
- name: figure out which kernel is currently running
check_mode: no
diff --git a/roles/ws/base/tasks/main.yml b/roles/ws/base/tasks/main.yml
index 23067abd..f562f6e3 100644
--- a/roles/ws/base/tasks/main.yml
+++ b/roles/ws/base/tasks/main.yml
@@ -45,7 +45,8 @@
state: present
- name: install exfat packages for legacy installs
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) < 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) < 22)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('<', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('<', 'jammy')))
apt:
name:
- exfat-fuse
@@ -53,7 +54,8 @@
state: present
- name: install exfat packages for new installs
- when: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) >= 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) >= 22)
+ when: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('>=', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('>=', 'jammy')))
apt:
name:
- exfatprogs
diff --git a/roles/x509/acmetool/base/tasks/main.yml b/roles/x509/acmetool/base/tasks/main.yml
index c2934b38..bb54db93 100644
--- a/roles/x509/acmetool/base/tasks/main.yml
+++ b/roles/x509/acmetool/base/tasks/main.yml
@@ -2,7 +2,8 @@
- name: check if acmetool package is new enough
assert:
msg: "Your distribution does contain an outdated version of acmetool"
- that: (ansible_distribution == 'Debian' and (ansible_distribution_major_version | int) >= 11) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_major_version | int) >= 20)
+ that: (ansible_distribution == 'Debian' and (ansible_distribution_release | debian_release_compare('>=', 'bullseye'))) or
+ (ansible_distribution == 'Ubuntu' and (ansible_distribution_release | ubuntu_release_compare('>=', 'focal')))
- name: install needed packages
apt: