Example state to install the latest kernel from package repositories:
install-latest-kernel: kernel.latest_installed: []
Example state to boot the system if a new kernel has been installed:
boot-latest-kernel: kernel.latest_active: - at_time: 1
Example state chaining the install and reboot operations:
install-latest-kernel: kernel.latest_installed: [] boot-latest-kernel: kernel.latest_active: - at_time: 1 - onchanges: - kernel: install-latest-kernel
Chaining can also be achieved using wait/listen requisites:
install-latest-kernel: kernel.latest_installed: [] boot-latest-kernel: kernel.latest_wait: - at_time: 1 - listen: - kernel: install-latest-kernel
Initiate a reboot if the running kernel is not the latest one installed.
Note
This state does not install any patches. It only compares the running kernel version number to other kernel versions also installed in the system. If the running version is not the latest one installed, this state will reboot the system.
See kernelpkg.upgrade
and latest_installed()
for ways to install new kernel packages.
This module does not attempt to understand or manage boot loader configurations it is possible to have a new kernel installed, but a boot loader configuration that will never activate it. For this reason, it would not be advisable to schedule this state to run automatically.
Because this state function may cause the system to reboot, it may be preferable to move it to the very end of the state run. See latest_wait()
for a waitable state that can be called with the listen requesite.
Ensure that the latest version of the kernel available in the repositories is installed.
Note
This state only installs the kernel, but does not activate it. The new kernel should become active at the next reboot. See kernelpkg.needs_reboot
for details on how to detect this condition, and latest_active()
to initiale a reboot when needed.
Initiate a reboot if the running kernel is not the latest one installed. This is the waitable version of latest_active()
and will not take any action unless triggered by a watch or listen requesite.
Note
Because this state function may cause the system to reboot, it may be preferable to move it to the very end of the state run using listen or listen_in requisites.
system-up-to-date:
pkg.uptodate:
- refresh: true
boot-latest-kernel:
kernelpkg.latest_wait:
- at_time: 1
- listen:
- pkg: system-up-to-date
Execute a kernelpkg state based on a watch or listen call
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.kernelpkg.html