diff options
author | Peter Mikus <peter.mikus@protonmail.ch> | 2024-10-18 14:26:36 +0200 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2024-10-24 10:41:05 +0000 |
commit | 34a7bf412a78d8c2e259d631ec770047fe5b311d (patch) | |
tree | 55edb0c514676b4a302718aeac9c48846cfbea6f /fdio.infra.ansible/roles/kernel/tasks | |
parent | 120716e561c1d0e3c7d06cbb96d1f70cf3949e5c (diff) |
feat(ansible): Ubuntu 24.04
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch>
Change-Id: Id486cbf0cdade79450912b54c068a3287c4edd36
Diffstat (limited to 'fdio.infra.ansible/roles/kernel/tasks')
-rw-r--r-- | fdio.infra.ansible/roles/kernel/tasks/main.yaml | 4 | ||||
-rw-r--r-- | fdio.infra.ansible/roles/kernel/tasks/ubuntu_jammy.yaml | 2 | ||||
-rw-r--r-- | fdio.infra.ansible/roles/kernel/tasks/ubuntu_noble.yaml | 62 |
3 files changed, 65 insertions, 3 deletions
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 |