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: kernelpkg.latest_active: - at_time: 1
Example state chaining the install and reboot operations:
install-latest-kernel: kernelpkg.latest_installed:  boot-latest-kernel: kernelpkg.latest_active: - at_time: 1 - onchanges: - kernelpkg: install-latest-kernel
Chaining can also be achieved using wait/listen requisites:
install-latest-kernel: kernelpkg.latest_installed:  boot-latest-kernel: kernelpkg.latest_wait: - at_time: 1 - listen: - kernelpkg: install-latest-kernel
latest_active(name, at_time=None, **kwargs)¶
Initiate a reboot if the running kernel is not the latest one installed.
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.
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.
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.
This state only installs the kernel, but does not activate it.
The new kernel should become active at the next reboot.
kernelpkg.needs_reboot for details on
how to detect this condition, and
to initiale a reboot when needed.
latest_wait(name, at_time=None, **kwargs)¶
Initiate a reboot if the running kernel is not the latest one installed. This is the
waitable version of
will not take any action unless triggered by a watch or listen requesite.
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
mod_watch(name, sfun, **kwargs)¶
The kernerpkg watcher, called to invoke the watch command. When called, execute a kernelpkg state based on a watch or listen call.
This state exists to support special handling of the
requisite. It should not be called directly.
Parameters for this function should be set by the state being triggered.