salt.modules.rebootmgr module

Module for rebootmgr :maintainer: Alberto Planas <aplanas@suse.com> :maturity: new :depends: None :platform: Linux

New in version 3004.

salt.modules.rebootmgr.cancel()

Cancels an already running reboot.

CLI Example:

salt microos rebootmgr cancel
salt.modules.rebootmgr.get_group()

The currently set lock group for etcd.

CLI Example:

salt microos rebootmgr get_group
salt.modules.rebootmgr.get_strategy()

The currently used reboot strategy of rebootmgrd will be printed.

CLI Example:

salt microos rebootmgr get_strategy
salt.modules.rebootmgr.get_window()

The currently set maintenance window will be printed.

CLI Example:

salt microos rebootmgr get_window
salt.modules.rebootmgr.is_active()

Check if the rebootmgrd is running and active or not.

CLI Example:

salt microos rebootmgr is_active
salt.modules.rebootmgr.lock(machine_id=None, group=None)
Lock a machine. If no group is specified, the local default group

will be used. If no machine-id is specified, the local machine will be locked.

machine_id

The machine-id is a network wide, unique ID. Per default the ID from /etc/machine-id is used.

group

Group name

CLI Example:

salt microos rebootmgr lock group=group1
salt.modules.rebootmgr.reboot(order=None)

Tells rebootmgr to schedule a reboot.

With the [now] option, a forced reboot is done, no lock from etcd is requested and a set maintenance window is ignored. With the [fast] option, a lock from etcd is requested if needed, but a defined maintenance window is ignored.

order

If specified, can be "now" or "fast"

CLI Example:

salt microos rebootmgr reboot
salt microos rebootmgt reboot order=now
salt.modules.rebootmgr.set_group(group)
Set the group, to which this machine belongs to get a reboot lock

from etcd.

group

Group name

CLI Example:

salt microos rebootmgr set_group group=group_1
salt.modules.rebootmgr.set_max(max_locks, group=None)
Set the maximal number of hosts in a group, which are allowed to

reboot at the same time.

number

Maximal number of hosts in a group

group

Group name

CLI Example:

salt microos rebootmgr set_max 4
salt.modules.rebootmgr.set_strategy(strategy=None)

A new strategy to reboot the machine is set and written into /etc/rebootmgr.conf.

strategy

If specified, must be one of those options:

best-effort - This is the default strategy. If etcd is

running, etcd-lock is used. If no etcd is running, but a maintenance window is specified, the strategy will be maint-window. If no maintenance window is specified, the machine is immediately rebooted (instantly).

etcd-lock - A lock at etcd for the specified lock-group will

be acquired before reboot. If a maintenance window is specified, the lock is only acquired during this window.

maint-window - Reboot does happen only during a specified

maintenance window. If no window is specified, the instantly strategy is followed.

instantly - Other services will be informed that a reboot will

happen. Reboot will be done without getting any locks or waiting for a maintenance window.

off - Reboot requests are temporary

ignored. /etc/rebootmgr.conf is not modified.

CLI Example:

salt microos rebootmgr set_strategy stragegy=off
salt.modules.rebootmgr.set_window(time, duration)

Set's the maintenance window.

time

The format of time is the same as described in systemd.time(7).

duration

The format of duration is "[XXh][YYm]".

CLI Example:

salt microos rebootmgr set_window time="Thu,Fri 2020-*-1,5 11:12:13" duration=1h
salt.modules.rebootmgr.status()

Returns the current status of rebootmgrd.

Valid returned values are:

0 - No reboot requested 1 - Reboot requested 2 - Reboot requested, waiting for maintenance window 3 - Reboot requested, waiting for etcd lock.

CLI Example:

salt microos rebootmgr status
salt.modules.rebootmgr.unlock(machine_id=None, group=None)
Unlock a machine. If no group is specified, the local default group

will be used. If no machine-id is specified, the local machine will be locked.

machine_id

The machine-id is a network wide, unique ID. Per default the ID from /etc/machine-id is used.

group

Group name

CLI Example:

salt microos rebootmgr unlock group=group1
salt.modules.rebootmgr.version()

Return the version of rebootmgrd

CLI Example:

salt microos rebootmgr version