blob: e40c2b8935f6f57d40911f2838f30a6ea9fd6102 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements; and to You under the Apache License, Version 2.0.
---
# This role will patch the kernel to the version defined in linux.version.
- name: "install headers for kernel {{ linux.version }}"
apt:
name: "linux-headers-{{ linux.version }}"
update_cache: yes
state: present
force: yes
become: true
- name: "install generic headers for kernel {{ linux.version }}"
apt:
name: "linux-headers-{{ linux.version }}-generic"
update_cache: yes
state: present
force: yes
become: true
- name: "install kernel {{ linux.version }}"
apt:
name: "linux-image-{{ linux.version }}-generic"
update_cache: yes
state: present
force: yes
become: true
register: patchKernel_apt
- name: restart host to load new kernel
shell: shutdown -r now
when: patchKernel_apt.changed
ignore_errors: true
become: true
- name: wait until host comes back up, timeout after 10 minutes
local_action: wait_for host={{ ansible_host }} port=22 state=started delay=10 timeout=600
# can not use apt module because of https://github.com/ansible/ansible-modules-core/issues/4029
- name: remove old kernels
shell: apt-get -y autoremove --purge
become: true