Skip to content

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

StateMeaning
runningThe service is active (started if it was stopped).
stoppedThe service is inactive (stopped if it was running).

Parameters

ParameterTypeRequiredDescription
enableboolBoot-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: true

Install 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: nginx

Stop and disable a service

service:
  telnet:
    state: stopped
    enable: false

Notes

  • 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.