diff --git a/ansible-scylla-loader/tasks/RedHat.yml b/ansible-scylla-loader/tasks/RedHat.yml index 326e2ce2..febb21b1 100644 --- a/ansible-scylla-loader/tasks/RedHat.yml +++ b/ansible-scylla-loader/tasks/RedHat.yml @@ -27,7 +27,7 @@ - name: Install the ELRepo kernel yum: - name: kernel-ml + name: kernel-lt state: present lock_timeout: 60 when: elrepo_kernel == True and (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") @@ -96,4 +96,3 @@ state: latest lock_timeout: 60 become: true - diff --git a/ansible-scylla-node/tasks/RedHat.yml b/ansible-scylla-node/tasks/RedHat.yml index 9137360c..1a91bca6 100644 --- a/ansible-scylla-node/tasks/RedHat.yml +++ b/ansible-scylla-node/tasks/RedHat.yml @@ -26,11 +26,14 @@ name: "https://www.elrepo.org/elrepo-release-{{ ansible_facts['distribution_major_version'] }}.el{{ ansible_facts['distribution_major_version'] }}.elrepo.noarch.rpm" state: present + - name: enable epel kernels + shell: | + yum-config-manager --enable elrepo-kernel + - name: Install ELRepo mainline kernel yum: - name: kernel-ml + name: kernel-lt state: present - enablerepo: elrepo-kernel lock_timeout: 60 register: kernel_installed @@ -54,6 +57,11 @@ command: grub2-mkconfig -o /boot/grub2/grub.cfg when: kernel_installed.changed + - name: Needs restarting? + command: needs-restarting -r + register: restart_required + ignore_errors: yes + - name: Reboot host and wait for it to restart reboot: msg: "Reboot initiated by Ansible" @@ -62,7 +70,15 @@ pre_reboot_delay: 0 post_reboot_delay: 30 test_command: whoami - when: reboot_after_kernel_upgrade|bool and kernel_installed.changed + when: (reboot_after_kernel_upgrade|bool and kernel_installed.changed) or restart_required.rc == 1 + + - name: Remove old kernels + package: + name: + - kernel + - kernel-ml + state: absent + when: elrepo_kernel|bool and install_type == 'online' and (ansible_distribution == "CentOS" or ansible_distribution == "RedHat") become: true