aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.ansible/roles/kernel')
-rw-r--r--fdio.infra.ansible/roles/kernel/defaults/main.yaml26
-rw-r--r--fdio.infra.ansible/roles/kernel/handlers/main.yaml4
-rw-r--r--fdio.infra.ansible/roles/kernel/tasks/main.yaml4
-rw-r--r--fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml2
-rw-r--r--fdio.infra.ansible/roles/kernel/tasks/ubuntu_noble.yaml62
5 files changed, 80 insertions, 18 deletions
diff --git a/fdio.infra.ansible/roles/kernel/defaults/main.yaml b/fdio.infra.ansible/roles/kernel/defaults/main.yaml
index ef628c93f5..6581eaf1b2 100644
--- a/fdio.infra.ansible/roles/kernel/defaults/main.yaml
+++ b/fdio.infra.ansible/roles/kernel/defaults/main.yaml
@@ -1,5 +1,5 @@
---
-# file: roles/kernel/defaults/main.yaml
+# file: defaults/main.yaml
# Kernel version to install (Default to any version).
kernel_version: "{{ kernel_version_by_distro[ansible_distribution|lower][ansible_distribution_release] | join(' ') }}"
@@ -8,24 +8,24 @@ kernel_version_by_distro:
ubuntu:
jammy:
- "5.15.0-46"
+ noble:
+ - "6.8.0-45"
-kernel_packages: "{{ kernel_packages_by_distro[ansible_distribution|lower][ansible_distribution_release] | flatten(levels=1) }}"
+kernel_packages: "{{ kernel_packages_by_distro[ansible_distribution|lower] | flatten(levels=1) }}"
kernel_packages_by_distro:
ubuntu:
- jammy:
- - "linux-image"
- - "linux-headers"
- - "linux-modules"
- - "linux-modules-extra"
- - "linux-tools"
+ - "linux-image"
+ - "linux-headers"
+ - "linux-modules"
+ - "linux-modules-extra"
+ - "linux-tools"
# Packages to remove in relation to kernel upgrade.
-absent_packages: "{{ absent_packages_by_distro[ansible_distribution|lower][ansible_distribution_release] | flatten(levels=1) }}"
+absent_packages: "{{ absent_packages_by_distro[ansible_distribution|lower] | flatten(levels=1) }}"
absent_packages_by_distro:
ubuntu:
- jammy:
- - "amd64-microcode"
- - "intel-microcode"
- - "iucode-tool"
+ - "amd64-microcode"
+ - "intel-microcode"
+ - "iucode-tool" \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/kernel/handlers/main.yaml b/fdio.infra.ansible/roles/kernel/handlers/main.yaml
index d0be276a5b..3f47ee457e 100644
--- a/fdio.infra.ansible/roles/kernel/handlers/main.yaml
+++ b/fdio.infra.ansible/roles/kernel/handlers/main.yaml
@@ -1,7 +1,7 @@
---
-# file roles/kernel/handlers/main.yaml
+# file handlers/main.yaml
-- name: Reboot Server
+- name: "Reboot Server"
ansible.builtin.reboot:
reboot_timeout: 3600
tags:
diff --git a/fdio.infra.ansible/roles/kernel/tasks/main.yaml b/fdio.infra.ansible/roles/kernel/tasks/main.yaml
index 431e344fb8..ec42ea1e6e 100644
--- a/fdio.infra.ansible/roles/kernel/tasks/main.yaml
+++ b/fdio.infra.ansible/roles/kernel/tasks/main.yaml
@@ -1,7 +1,7 @@
---
-# file: roles/kernel/tasks/main.yaml
+# file: tasks/main.yaml
-- name: Inst - Prerequisites
+- name: "Prerequisites"
include_tasks: "{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml"
tags:
- kernel-inst-prerequisites
diff --git a/fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml b/fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml
index af987d4e5a..430050d79f 100644
--- a/fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml
+++ b/fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml
@@ -1,5 +1,5 @@
---
-# file: roles/kernel/tasks/ubuntu_jammy.yaml
+# file: tasks/ubuntu_jammy.yaml
- name: Get Available Kernel Versions
ansible.builtin.command: "apt-cache showpkg linux-headers-*"
diff --git a/fdio.infra.ansible/roles/kernel/tasks/ubuntu_noble.yaml b/fdio.infra.ansible/roles/kernel/tasks/ubuntu_noble.yaml
new file mode 100644
index 0000000000..1702ecc07d
--- /dev/null
+++ b/fdio.infra.ansible/roles/kernel/tasks/ubuntu_noble.yaml
@@ -0,0 +1,62 @@
+---
+# file: tasks/ubuntu_noble.yaml
+
+- name: "Get Available Kernel Versions"
+ ansible.builtin.command: "apt-cache showpkg linux-headers-*"
+ changed_when: false
+ register: apt_kernel_list
+ tags:
+ - kernel-inst
+
+- name: "Get installed packages with APT"
+ ansible.builtin.command: "dpkg -l"
+ changed_when: false
+ register: apt_packages_list
+ tags:
+ - kernel-inst
+
+- name: "Set target APT kernel version"
+ ansible.builtin.set_fact:
+ _kernel: "{{ apt_kernel_list | deb_kernel(
+ kernel_version, ansible_kernel) }}"
+ tags:
+ - kernel-inst
+
+- name: "Disable APT auto upgrade"
+ ansible.builtin.lineinfile:
+ path: "/etc/apt/apt.conf.d/20auto-upgrades"
+ state: "present"
+ regexp: "APT::Periodic::Unattended-Upgrade \"[0-9]\";"
+ line: "APT::Periodic::Unattended-Upgrade \"0\";"
+ create: true
+ mode: 0644
+ tags:
+ - kernel-inst
+
+- name: "Ensure Packages Versions"
+ ansible.builtin.apt:
+ name: "{{ apt_kernel_list | deb_kernel_pkg(
+ kernel_version, ansible_kernel, ansible_distribution,
+ ansible_architecture, item) }}"
+ loop: "{{ kernel_packages }}"
+ tags:
+ - kernel-inst
+
+- name: "Ensure Any Other Kernel Packages Are Removed"
+ ansible.builtin.apt:
+ name: "{{ apt_packages_list | deb_installed_kernel(
+ apt_kernel_list, kernel_version, ansible_kernel) }}"
+ state: "absent"
+ purge: true
+ notify:
+ - "Reboot Server"
+ tags:
+ - kernel-inst
+
+- name: "Ensure Any Microcode Is Absent"
+ ansible.builtin.apt:
+ name: "{{ absent_packages }}"
+ state: "absent"
+ purge: true
+ tags:
+ - kernel-inst