Service

The service resource manages system services. Services have two independent properties: whether they are running and whether they are enabled to start at boot.

Warning

Use real service names, not virtual names or aliases.

Services can subscribe to other resources and restart when those resources change.

- service:
    - httpd:
        ensure: running
        enable: true
        subscribe:
          - package#httpd
ccm ensure service httpd running --enable --subscribe package#httpd
{
  "protocol": "io.choria.ccm.v1.resource.ensure.request",
  "type": "service",
  "properties": {
    "name": "httpd",
    "ensure": "running",
    "enable": true,
    "subscribe": ["package#httpd"]
  }
}

Ensure Values

ValueDescription
runningThe service must be running
stoppedThe service must be stopped

If ensure is not specified, it defaults to running.

Properties

PropertyDescription
nameService name
ensureDesired state (running or stopped; default: running)
enable (boolean)Enable the service to start at boot
subscribe (array)Resources to watch; restart the service when they change (type#name or type#alias)
providerForce a specific provider (systemd only)