service
Manages a system service’s running state and, optionally, its boot-enablement. Running and enabled-at-boot are orthogonal axes. Idempotent: re-applying an unchanged declaration reports no change.
Category: System & core
States
| State | Meaning |
|---|---|
running | The service is active (started if it was stopped). |
stopped | The service is inactive (stopped if it was running). |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
enable | bool | Boot-enablement: true enables the unit at boot, false disables it. Omit to leave the boot-state untouched. |
Examples
Run and enable a service at boot
service:
nginx:
state: running
enable: trueInstall the package, then ensure its service runs
The require requisite orders the service after the package that provides the unit.
service:
nginx:
state: running
enable: true
require:
- package: nginxStop and disable a service
service:
telnet:
state: stopped
enable: falseNotes
- Linux only; no init system on other operating systems is supported.
- systemd and OpenRC backends are stable (verified on the live distro matrix); the sysvinit backend is experimental (implemented and fixture-tested, but no sysvinit-default distro is in the live matrix).
- The unit must already exist on the host — install the providing package first, typically via a
require: [package: <name>]relationship. - Out of scope for v0.1: separate mask/unmask,
reload, restart-on-change, and unit listing/inspection.