diff options
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/kernel')
5 files changed, 102 insertions, 28 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/kernel/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/kernel/defaults/main.yaml index d84a163487..b9b4253622 100644 --- a/resources/tools/testbed-setup/ansible/roles/kernel/defaults/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/kernel/defaults/main.yaml @@ -2,27 +2,42 @@ # file: roles/kernel/defaults/main.yaml # Kernel version to install (Default to any version). -kernel_version: "{{ kernel_version_by_distro[ansible_distribution | lower] | join(' ') }}" +kernel_version: "{{ kernel_version_by_distro[ansible_distribution|lower][ansible_distribution_release] | join(' ') }}" kernel_version_by_distro: ubuntu: - - "4.15.0-72" + bionic: + - "4.15.0-72" + focal: + - "5.4.0-65" -kernel_packages: "{{ kernel_packages_by_distro[ansible_distribution | lower] | flatten(levels=1) }}" +kernel_packages: "{{ kernel_packages_by_distro[ansible_distribution|lower][ansible_distribution_release] | flatten(levels=1) }}" kernel_packages_by_distro: ubuntu: - - "linux-image" - - "linux-headers" - - "linux-modules" - - "linux-modules-extra" - - "linux-tools" + bionic: + - "linux-image" + - "linux-headers" + - "linux-modules" + - "linux-modules-extra" + - "linux-tools" + focal: + - "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] | flatten(levels=1) }}" +absent_packages: "{{ absent_packages_by_distro[ansible_distribution|lower][ansible_distribution_release] | flatten(levels=1) }}" absent_packages_by_distro: ubuntu: - - "amd64-microcode" - - "intel-microcode" - - "iucode-tool" + bionic: + - "amd64-microcode" + - "intel-microcode" + - "iucode-tool" + focal: + - "amd64-microcode" + - "intel-microcode" + - "iucode-tool"
\ No newline at end of file diff --git a/resources/tools/testbed-setup/ansible/roles/kernel/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/kernel/handlers/main.yaml index 3d30a0973c..963fd71756 100644 --- a/resources/tools/testbed-setup/ansible/roles/kernel/handlers/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/kernel/handlers/main.yaml @@ -4,3 +4,5 @@ - name: Reboot Server reboot: reboot_timeout: 3600 + tags: + - reboot-server
\ No newline at end of file diff --git a/resources/tools/testbed-setup/ansible/roles/kernel/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/main.yaml index 4c63c709a6..431e344fb8 100644 --- a/resources/tools/testbed-setup/ansible/roles/kernel/tasks/main.yaml +++ b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/main.yaml @@ -1,8 +1,9 @@ --- # file: roles/kernel/tasks/main.yaml -- name: Kernel - Install distribution - release - include_tasks: '{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml' - tags: install-kernel +- name: Inst - Prerequisites + include_tasks: "{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml" + tags: + - kernel-inst-prerequisites - meta: flush_handlers diff --git a/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_bionic.yaml index 3cb79352ee..349c853c11 100644 --- a/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_bionic.yaml +++ b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_bionic.yaml @@ -1,33 +1,37 @@ --- # file: roles/kernel/tasks/ubuntu_bionic.yaml -- name: Kernel - Get Available Kernel Versions +- name: Get Available Kernel Versions command: "apt-cache showpkg linux-headers-*" changed_when: false register: apt_kernel_list - tags: install-kernel + tags: + - kernel-inst -- name: Kernel - Get installed packages with APT +- name: Get installed packages with APT command: "dpkg -l" changed_when: false register: apt_packages_list - tags: install-kernel + tags: + - kernel-inst -- name: Kernel - Set target APT kernel version +- name: Set target APT kernel version set_fact: _kernel: "{{ apt_kernel_list | deb_kernel( kernel_version, ansible_kernel) }}" - tags: install-kernel + tags: + - kernel-inst -- name: Kernel - Ensure Packages Versions +- name: Ensure Packages Versions apt: name: "{{ apt_kernel_list | deb_kernel_pkg( kernel_version, ansible_kernel, ansible_distribution, ansible_architecture, item) }}" loop: "{{ kernel_packages }}" - tags: install-kernel + tags: + - kernel-inst -- name: Kernel - Ensure Any Other Kernel Packages Are Removed +- name: Ensure Any Other Kernel Packages Are Removed apt: name: "{{ apt_packages_list | deb_installed_kernel( apt_kernel_list, kernel_version, ansible_kernel) }}" @@ -35,12 +39,13 @@ purge: true notify: - "Reboot Server" - tags: install-kernel + tags: + - kernel-inst -- name: Kernel - Ensure Any Microcode Is Absent +- name: Ensure Any Microcode Is Absent apt: name: "{{ absent_packages }}" state: absent purge: true - tags: install-kernel - + tags: + - kernel-inst
\ No newline at end of file diff --git a/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_focal.yaml b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_focal.yaml new file mode 100644 index 0000000000..9cbc4d4787 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/kernel/tasks/ubuntu_focal.yaml @@ -0,0 +1,51 @@ +--- +# file: roles/kernel/tasks/ubuntu_focal.yaml + +- name: Get Available Kernel Versions + command: "apt-cache showpkg linux-headers-*" + changed_when: false + register: apt_kernel_list + tags: + - kernel-inst + +- name: Get installed packages with APT + command: "dpkg -l" + changed_when: false + register: apt_packages_list + tags: + - kernel-inst + +- name: Set target APT kernel version + set_fact: + _kernel: "{{ apt_kernel_list | deb_kernel( + kernel_version, ansible_kernel) }}" + tags: + - kernel-inst + +- name: Ensure Packages Versions + 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 + 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 + apt: + name: "{{ absent_packages }}" + state: absent + purge: true + tags: + - kernel-inst
\ No newline at end of file |