Skip to content

sd_service

!sd_service

Category: services

Manage a systemd service’s enabled/started state via systemctl. Conflicts (started:false + restart:true) fail; restart without started implies start-if-stopped.

Parameters

NameTypeRequiredDescription
servicestringyessystemd unit name (e.g. nginx.service).
enabledboolnoDesired enablement state (systemctl enable/disable). If omitted, left unchanged.
startedboolnoDesired running state (systemctl start/stop). If omitted with restart, restarts if running or starts if stopped.
restartboolnoRestart the service if it is (or should be) running (systemctl restart).

Examples

- !sd_service
  service: nginx
  enabled: true
  started: true