Overhaul reuse structure from role to task orientation
The overall config this will end up with is going to be nowhere near complicated enough to require the segmented structure of roles. A single directory of reusable tasks and resources will be much better
This commit is contained in:
@@ -1,62 +1,61 @@
|
||||
---
|
||||
- name: Disable kernel installation from base repository
|
||||
# This is a workaround for Cent8 removing drivers from the kernel that are required for
|
||||
# my RAID cards to work. Kernel-Plus includes the drivers, thus one of the first things
|
||||
# we need to do is to replace the kernel before doing an update.
|
||||
- name: Replace default kernel with kernel-plus on CentOS 8
|
||||
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "8"
|
||||
become: true
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-Base.repo
|
||||
line: exclude=kernel*
|
||||
block:
|
||||
- name: Disable kernel installation from base repository
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-Base.repo
|
||||
line: exclude=kernel*
|
||||
|
||||
- name: Enable Centos-plus repository
|
||||
become: true
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-centosplus.repo
|
||||
regexp: "#?enabled=(0|1)"
|
||||
line: enabled=1
|
||||
- name: Enable Centos-plus repository
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-centosplus.repo
|
||||
regexp: "#?enabled=(0|1)"
|
||||
line: enabled=1
|
||||
|
||||
- name: Enable kernel installation from plus repository
|
||||
become: true
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-centosplus.repo
|
||||
line: includepkgs=kernel*
|
||||
- name: Enable kernel installation from plus repository
|
||||
lineinfile:
|
||||
path: /etc/yum.repos.d/CentOS-centosplus.repo
|
||||
line: includepkgs=kernel*
|
||||
|
||||
# Note that the order of the next four tasks is very specific and intentional
|
||||
# See this wiki page: https://plone.lucidsolutions.co.nz/linux/centos/7/install-centos-plus-kernel-kernel-plus/view
|
||||
- name: Install kernel-plus
|
||||
become: true
|
||||
dnf:
|
||||
name:
|
||||
- kernel-plus
|
||||
- kernel-plus-devel
|
||||
state: latest
|
||||
register: _dnf_kernel_plus
|
||||
# Note that the order of the next four tasks is very specific and intentional
|
||||
# See this wiki page: https://plone.lucidsolutions.co.nz/linux/centos/7/install-centos-plus-kernel-kernel-plus/view
|
||||
- name: Install kernel-plus
|
||||
dnf:
|
||||
state: "{{ _runtime_update_state }}"
|
||||
name:
|
||||
- kernel-plus
|
||||
- kernel-plus-devel
|
||||
register: _dnf_kernel_plus
|
||||
|
||||
- name: Uninstall kernel-tools
|
||||
become: true
|
||||
dnf:
|
||||
name:
|
||||
- kernel-tools
|
||||
- kernel-tools-libs
|
||||
state: absent
|
||||
- name: Uninstall kernel-tools
|
||||
dnf:
|
||||
name:
|
||||
- kernel-tools
|
||||
- kernel-tools-libs
|
||||
state: absent
|
||||
|
||||
- name: Install kernel-plus-tools
|
||||
become: true
|
||||
dnf:
|
||||
name:
|
||||
- kernel-plus-tools
|
||||
- kernel-plus-tools-libs
|
||||
state: latest
|
||||
- name: Install kernel-plus-tools
|
||||
dnf:
|
||||
state: "{{ _runtime_update_state }}"
|
||||
name:
|
||||
- kernel-plus-tools
|
||||
- kernel-plus-tools-libs
|
||||
|
||||
- name: Reboot into new kernel
|
||||
become: true
|
||||
when: _dnf_kernel_plus.changed is true and "centos.plus" not in ansible_kernel
|
||||
reboot:
|
||||
reboot_timeout: 3600
|
||||
- name: Reboot into new kernel
|
||||
when: _dnf_kernel_plus.changed is true and "centos.plus" not in ansible_kernel
|
||||
reboot:
|
||||
reboot_timeout: 3600
|
||||
|
||||
- name: Uninstall kernel
|
||||
become: true
|
||||
dnf:
|
||||
name:
|
||||
- kernel
|
||||
- kernel-devel
|
||||
- kernel-core
|
||||
- kernel-modules
|
||||
state: absent
|
||||
- name: Uninstall kernel
|
||||
dnf:
|
||||
state: absent
|
||||
name:
|
||||
- kernel
|
||||
- kernel-devel
|
||||
- kernel-core
|
||||
- kernel-modules
|
||||
|
||||
Reference in New Issue
Block a user