-
Notifications
You must be signed in to change notification settings - Fork 48
fix: (host-setup) properly set and pin the desired kernel #920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,44 +18,59 @@ | |
filter: "ansible_kernel" | ||
|
||
- name: Check Kernel Version | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the intent of this check was to ensure that the deployed kernel on a given host met our minimum requirements. If we go down the path of pinning to a specific kernel version, we can eliminate this task. |
||
ansible.builtin.fail: | ||
ansible.builtin.debug: | ||
msg: > | ||
Wrong kernel Version found | ||
[ {{ ansible_facts['kernel'] }} < {{ host_required_kernel }} ] | ||
[ {{ ansible_facts['kernel'] }} != {{ host_required_kernel }} ] | ||
Resolve this issue before continuing. | ||
when: | ||
- ansible_facts['kernel'] is version(host_required_kernel, '<') | ||
- ansible_facts['kernel'] is version(host_required_kernel, '!=') | ||
|
||
- name: Pin kernel packages version | ||
ansible.builtin.copy: | ||
dest: "{{ apt_preferences }}/pin-kernel" | ||
content: | | ||
Package: linux-image-{{ ansible_facts['kernel'] }} | ||
- name: "Install specific kernel image/modules/extra version {{ host_required_kernel }}" | ||
ansible.builtin.package: | ||
name: | ||
- "linux-image-{{ host_required_kernel }}" | ||
rackerchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- "linux-modules-{{ host_required_kernel }}" | ||
- "linux-modules-extra-{{ host_required_kernel }}" | ||
state: present | ||
|
||
- name: "Update grub to boot the desired kernel {{ host_required_kernel }}" | ||
ansible.builtin.lineinfile: | ||
path: /etc/default/grub | ||
regexp: '^GRUB_DEFAULT=' | ||
line: 'GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux {{ host_required_kernel }}"' | ||
notify: "Update Grub" | ||
|
||
- name: Update Grub | ||
ansible.builtin.command: update-grub2 | ||
become: yes | ||
|
||
- name: Create apt preference file for specific kernel | ||
ansible.builtin.blockinfile: | ||
path: "{{ apt_preferences }}/pin-kernel" | ||
create: true | ||
block: | | ||
Package: linux-image-{{ host_required_kernel }} | ||
Pin: release * | ||
Pin-Priority: 1001 | ||
|
||
Package: linux-headers-{{ ansible_facts['kernel'] }} | ||
Package: linux-modules-{{ host_required_kernel }} | ||
rackerchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Pin: release * | ||
Pin-Priority: 1001 | ||
|
||
Package: linux-modules-{{ ansible_facts['kernel'] }} | ||
Package: linux-modules-extra-{{ host_required_kernel }} | ||
Pin: release * | ||
Pin-Priority: 1001 | ||
|
||
Package: linux-image-* | ||
Pin: release * | ||
Pin-Priority: -1 | ||
|
||
Package: linux-headers-* | ||
Pin: release * | ||
Pin-Priority: -1 | ||
|
||
Package: linux-modules-* | ||
Pin: release * | ||
Pin-Priority: -1 | ||
mode: '0644' | ||
when: | ||
- ansible_facts['kernel'] is version(host_required_kernel, '<') | ||
when: ansible_distribution == 'Ubuntu' | ||
|
||
- name: Disable unattended-upgrades | ||
ansible.builtin.lineinfile: | ||
|
@@ -75,6 +90,6 @@ | |
value: "0" | ||
|
||
- name: Ensure unattended-upgrades package is removed | ||
ansible.builtin.apt: | ||
ansible.builtin.package: | ||
name: unattended-upgrades | ||
state: absent |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we'll need an equal configuration setup for debian defined here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
--- | ||
|
||
## Defined required kernel | ||
host_required_kernel: 6.8.0-0-generic | ||
# This variable is used to set the default kernel in grub. Ensure you are | ||
# using the ENTIRE output from uname -r | ||
host_required_kernel: 6.8.0-47-generic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The latest kernel in this series is |
||
host_sysstat_file: /etc/default/sysstat | ||
host_sysstat_cron_file: /etc/cron.d/sysstat | ||
host_cron_template: sysstat.cron.debian.j2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to create an opt-out interface for the task that calls this file; thinking of how we might need to run other kernel versions like
linux-image-6.8.0-1006-intel
for some of the accelerator work we're aiming to release in flex in the not so distant future.