summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-05-08 23:50:15 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-05-08 23:50:15 +0200
commit1e98ae0956ddffbec44ce0eac5f9a3e1fa45f434 (patch)
tree943ded901681f9ebbc4222f546a146d6de93624a
parentadd raspi5 test host and fix raspios image network config (diff)
some more fixes for ubuntu-installer
-rw-r--r--filter_plugins/os-version.py83
-rw-r--r--roles/core/base/tasks/Debian.yml1
-rw-r--r--roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j25
3 files changed, 89 insertions, 0 deletions
diff --git a/filter_plugins/os-version.py b/filter_plugins/os-version.py
new file mode 100644
index 00000000..4c5c3a29
--- /dev/null
+++ b/filter_plugins/os-version.py
@@ -0,0 +1,83 @@
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible import errors
+
+_ubuntu_release_names_ = {
+ "focal": 2004,
+ "groovy": 2010,
+ "hisrute": 2104,
+ "impish": 2110,
+ "jammy": 2204,
+ "kinetic": 2210,
+ "lunar": 2304,
+ "mantic": 2310,
+ "noble": 2404,
+ "oracular": 2410,
+}
+
+_debian_release_names_ = {
+ "buster": 10,
+ "bullseye": 11,
+ "bookworm": 12,
+ "trixie": 13,
+ "forky": 14,
+}
+
+
+def ubuntu_release_after(a, b):
+ try:
+ av = _ubuntu_release_names_[a]
+ bv = _ubuntu_release_names_[b]
+ return (av > bv)
+ except KeyError as e:
+ raise errors.AnsibleFilterError("unknown ubuntu release: %s" % str(e))
+ except Exception as e:
+ raise errors.AnsibleFilterError("ubuntu_release_after(): %s" % str(e))
+
+
+def ubuntu_release_before(a, b):
+ try:
+ av = _ubuntu_release_names_[a]
+ bv = _ubuntu_release_names_[b]
+ return (av < bv)
+ except KeyError as e:
+ raise errors.AnsibleFilterError("unknown ubuntu release: %s" % str(e))
+ except Exception as e:
+ raise errors.AnsibleFilterError("ubuntu_release_before(): %s" % str(e))
+
+
+def debian_release_after(a, b):
+ try:
+ av = _debian_release_names_[a]
+ bv = _debian_release_names_[b]
+ return (av > bv)
+ except KeyError as e:
+ raise errors.AnsibleFilterError("unknown debian release: %s" % str(e))
+ except Exception as e:
+ raise errors.AnsibleFilterError("debian_release_after(): %s" % str(e))
+
+
+def debian_release_before(a, b):
+ try:
+ av = _debian_release_names_[a]
+ bv = _debian_release_names_[b]
+ return (av < bv)
+ except KeyError as e:
+ raise errors.AnsibleFilterError("unknown debian release: %s" % str(e))
+ except Exception as e:
+ raise errors.AnsibleFilterError("debian_release_before(): %s" % str(e))
+
+
+class FilterModule(object):
+
+ ''' os version compare '''
+ filter_map = {
+ 'ubuntu_release_after': ubuntu_release_after,
+ 'ubuntu_release_before': ubuntu_release_before,
+ 'debian_release_after': debian_release_after,
+ 'debian_release_before': debian_release_before,
+ }
+
+ def filters(self):
+ return self.filter_map
diff --git a/roles/core/base/tasks/Debian.yml b/roles/core/base/tasks/Debian.yml
index fcef9af3..7056a9bc 100644
--- a/roles/core/base/tasks/Debian.yml
+++ b/roles/core/base/tasks/Debian.yml
@@ -43,6 +43,7 @@
- wget
- iotop-c
- bwm-ng
+ - tzdata
state: present
## TODO: install dool on newer systems... or all of them. From which package source??
diff --git a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
index 1635e84f..3d12091e 100644
--- a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
+++ b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
@@ -259,10 +259,15 @@ autoinstall:
- curtin in-target --target=/target -- bash -c "mkdir -p /etc/systemd/system/ssh.socket.d; echo -e '[Socket]\nListenStream=\nListenStream={{ ansible_port }}' > /etc/systemd/system/ssh.socket.d/port.conf"
{% endif %}
- curtin in-target --target=/target -- apt-get -y -q purge multipath-tools open-vm-tools
+{% if not (install_codename | ubuntu_release_before('jammy')) %}
- curtin in-target --target=/target -- apt-get -y -q purge systemd-oomd
+{% endif %}
{% if ubuntu_autoinstall_desktop is undefined %}
- curtin in-target --target=/target -- apt-mark manual iputils-ping isc-dhcp-client netcat-openbsd netplan.io sudo
- curtin in-target --target=/target -- apt-get -y -q purge policykit-1 ubuntu-minimal unattended-upgrades ubuntu-advantage-tools sound-theme-freedesktop thin-provisioning-tools cryptsetup byobu open-iscsi btrfs-progs pollinate lxd-agent-loader ufw
+{% if not (install_codename | ubuntu_release_before('noble')) %}
+ - curtin in-target --target=/target -- apt-get -y -q purge ubuntu-kernel-accessories
+{% endif %}
{% if install.disks.primary != "software-raid" %}
- curtin in-target --target=/target -- apt-get -y -q purge mdadm
{% endif %}