Skip to content

Systemd Service

The builtin.systemd_service resource allows you to manage the state of a systemd service.

Resource parameters

NameDescriptionRequiredDefault
nameThe name of the service you want to managetrue
enabledWhether or not the service should be enabledfalsetrue
maskedWhether or not the service should be maskedfalsefalse
stateThe state the service should betrue

Examples

Start service nginx

yaml
- title: "Start nginx.service"
  type: "builtin.systemd_service"
  present: true
  data:
    name: "nginx.service"
    state: "started"

Stop service nginx

yaml
- title: "Stop nginx.service"
  type: "builtin.systemd_service"
  present: true
  data:
    name: "nginx.service"
    state: "stop"

Reload service nginx

yaml
- title: "Reload nginx.service"
  type: "builtin.systemd_service"
  present: true
  data:
    name: "nginx.service"
    state: "reload"