This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make RedHat kernel list more generic
- Loading branch information
Showing
4 changed files
with
89 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
--- | ||
skip_list: | ||
# Required to list with extra arguments | ||
- '303' | ||
- role-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
|
||
- name: Ensure APT cache is up to date | ||
apt: | ||
update_cache: true | ||
changed_when: false | ||
retries: 10 | ||
delay: 1 | ||
register: _apt_update | ||
until: _apt_update is successful | ||
|
||
- name: Get available kernel versions | ||
command: apt-cache showpkg linux-headers-* | ||
changed_when: false | ||
register: apt_kernel_list | ||
|
||
- name: Get installed packages | ||
command: dpkg -l | ||
changed_when: false | ||
register: apt_packages_list | ||
|
||
- name: Set target kernel version | ||
set_fact: _kernel="{{ apt_kernel_list | | ||
deb_kernel(kernel_version, ansible_kernel, | ||
kernel_variant | default(omit)) }}" | ||
|
||
- name: "Ensure kernel {{ _kernel }} packages are installed" | ||
apt: | ||
name: "{{ item.name | deb_kernel_package(_kernel, ansible_architecture) }}" | ||
retries: 10 | ||
delay: 1 | ||
register: _apt_install | ||
until: _apt_install is successful | ||
when: item.when | ||
with_items: | ||
- name: linux-image | ||
when: true | ||
- name: linux-headers | ||
when: install_kernel_headers | bool | ||
|
||
- name: Ensure any other kernel packages are removed | ||
apt: | ||
name: "{{ apt_packages_list | deb_installed_kernel(_kernel, ansible_architecture) }}" | ||
state: absent | ||
purge: true | ||
tags: molecule-idempotence-notest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
|
||
- name: Ensure CentOS Vault repositories are up to date | ||
package: | ||
name: centos-release | ||
state: latest # noqa package-latest | ||
retries: 10 | ||
delay: 1 | ||
register: _centos_release | ||
until: _centos_release is successful | ||
when: ansible_distribution == 'CentOS' | ||
|
||
- name: Get available kernel versions | ||
command: "{{ ansible_pkg_mgr }} list --enablerepo=* --disablerepo=media-*,*-media --showduplicates kernel" | ||
changed_when: false | ||
args: | ||
warn: false | ||
retries: 10 | ||
delay: 1 | ||
until: rhel_kernel_list is successful | ||
register: rhel_kernel_list | ||
|
||
- name: Set target kernel version | ||
set_fact: _kernel="{{ rhel_kernel_list | rhel_kernel(kernel_version, ansible_kernel) }}" | ||
|
||
- name: "Ensure kernel {{ _kernel }} packages are installed" | ||
package: | ||
name: "{{ item.name }}-{{ _kernel }}" | ||
enablerepo: "{{ rhel_kernel_list | rhel_repo(kernel_version, ansible_kernel) }}" | ||
allow_downgrade: true | ||
retries: 10 | ||
delay: 1 | ||
register: _rhel_install | ||
until: _rhel_install is successful | ||
when: item.when | ||
with_items: | ||
- name: kernel | ||
when: true | ||
- name: kernel-devel | ||
when: install_kernel_headers | bool | ||
- name: kernel-headers | ||
when: install_kernel_headers | bool |