Provides the service module for systemd
New in version 0.10.0.
Important
If you feel that Salt should be using this module to manage services on a minion, and it is using a different module (or gives an error similar to 'service.start' is not available), see here.
salt.modules.systemd.
available
(name)¶New in version 0.10.4.
Check that the given service is available taking into account template units.
CLI Example:
salt '*' service.available sshd
salt.modules.systemd.
disable
(name, **kwargs)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Disable the named service to not start when the system boots
CLI Example:
salt '*' service.disable <service name>
salt.modules.systemd.
disabled
(name)¶Return if the named service is disabled to start on boot
CLI Example:
salt '*' service.disabled <service name>
salt.modules.systemd.
enable
(name, **kwargs)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Enable the named service to start when the system boots
CLI Example:
salt '*' service.enable <service name>
salt.modules.systemd.
enabled
(name, **kwargs)¶Return if the named service is enabled to start on boot
CLI Example:
salt '*' service.enabled <service name>
salt.modules.systemd.
execs
()¶New in version 2014.7.0.
Return a list of all files specified as ExecStart
for all services.
CLI Example:
salt '*' service.execs
salt.modules.systemd.
force_reload
(name)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
New in version 0.12.0.
Force-reload the specified service with systemd
CLI Example:
salt '*' service.force_reload <service name>
salt.modules.systemd.
get_all
()¶Return a list of all available services
CLI Example:
salt '*' service.get_all
salt.modules.systemd.
get_disabled
()¶Return a list of all disabled services
CLI Example:
salt '*' service.get_disabled
salt.modules.systemd.
get_enabled
()¶Return a list of all enabled services
CLI Example:
salt '*' service.get_enabled
salt.modules.systemd.
get_static
()¶New in version 2015.8.5.
Return a list of all static services
CLI Example:
salt '*' service.get_static
salt.modules.systemd.
mask
(name, runtime=False)¶New in version 2015.5.0.
Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Mask the specified service with systemd
Set to True
to mask this service only until the next reboot
New in version 2015.8.5.
CLI Example:
salt '*' service.mask <service name>
salt.modules.systemd.
masked
(name)¶New in version 2015.8.0.
Changed in version 2015.8.5: The return data for this function has changed. If the service is
masked, the return value will now be the output of the systemctl
is-enabled
command (so that a persistent mask can be distinguished
from a runtime mask). If the service is not masked, then False
will
be returned.
Check whether or not a service is masked
CLI Example:
salt '*' service.masked <service name>
salt.modules.systemd.
missing
(name)¶New in version 2014.1.0.
The inverse of service.available
. Returns True
if the specified
service is not available, otherwise returns False
.
CLI Example:
salt '*' service.missing sshd
salt.modules.systemd.
reload
(name)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Reload the specified service with systemd
CLI Example:
salt '*' service.reload <service name>
salt.modules.systemd.
restart
(name)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Restart the specified service with systemd
CLI Example:
salt '*' service.restart <service name>
salt.modules.systemd.
show
(name)¶New in version 2014.7.0.
Show properties of one or more units/jobs or the manager
CLI Example:
salt '*' service.show <service name>
salt.modules.systemd.
start
(name)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Start the specified service with systemd
CLI Example:
salt '*' service.start <service name>
salt.modules.systemd.
status
(name, sig=None)¶Return the status for a service via systemd, returns a bool whether the service is running.
CLI Example:
salt '*' service.status <service name>
salt.modules.systemd.
stop
(name)¶Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Stop the specified service with systemd
CLI Example:
salt '*' service.stop <service name>
salt.modules.systemd.
systemctl_reload
()¶New in version 0.15.0.
Reloads systemctl, an action needed whenever unit files are updated.
CLI Example:
salt '*' service.systemctl_reload
salt.modules.systemd.
unmask
(name)¶New in version 2015.5.0.
Changed in version 2015.8.12,2016.3.3,Carbon: On minions running systemd>=205, systemd-run(1) is now used to
isolate commands run by this function from the salt-minion
daemon's
control group. This is done to avoid a race condition in cases where
the salt-minion
service is restarted while a service is being
modified. If desired, usage of systemd-run(1) can be suppressed by
setting a config option
called
systemd.scope
, with a value of False
(no quotes).
Unmask the specified service with systemd
CLI Example:
salt '*' service.unmask <service name>