zester
GuidesModules

service.enabled

Ensures a service is enabled to start at boot. Does not affect whether the service is currently running.

Source: pkg/state/modules/service.go


Parameters

ParameterTypeRequiredDefaultDescription
namestringNoState IDThe service name. If omitted, the state ID is used.

All states also accept the full set of requisite parameters and Salt-parity state attributes — see Dependencies & Requisites.


Check Behavior

  • Calls systemctl is-enabled --quiet <service> (via the injected ServiceExec).
  • Reports no changes needed if the service is already enabled.
  • Reports NeedsChange: true if the service is not enabled.

Apply Behavior

  1. Calls Enable on the service manager.
  2. Returns Changed: true.

Revert Behavior

  • Calls Disable on the service manager.
  • Returns Changed: true.

Details Returned

KeyDescription
serviceThe service name
managerThe service manager name (e.g., "systemd")

Examples

Ensure sshd starts at boot

sshd:
  service.enabled:
    - require:
      - pkg.installed:openssh-server

Enable after installation

openssh-server:
  pkg.installed: []

sshd:
  service.enabled:
    - require:
      - pkg.installed:openssh-server

Explicit name

enable-nginx-boot:
  service.enabled:
    - name: nginx

On this page