Skip to Content

Units

systemd units of the host.

OperationKindHTTP
units.listcallGET /v1/units
units.getcallGET /v1/units/{unit}
units.actcallPOST /v1/units/{unit}/{verb}

units.list

The units and their state.

Host level only. Through rookery serve it needs the role view.

Result

Unit[]

Request
{
  "id": 1,
  "op": "units.list"
}
Reply
{
  "id": 1,
  "result": [
    {
      "active": "text",
      "description": "text",
      "load": "text",
      "sub": "text",
      "unit": "rookeryd.service"
    }
  ]
}

units.get

One unit's properties, as systemctl show gives them.

Host level only. Through rookery serve it needs the role view.

Arguments

NameWhereRequiredDescription
unitpathyesA unit's name, such as ssh.service. Only the configured units.

Result

map of string

Request
{
  "id": 1,
  "op": "units.get",
  "args": {
    "unit": "rookeryd.service"
  }
}
Reply
{
  "id": 1,
  "result": {}
}

units.act

Start, stop, restart, reload, enable or disable a unit.

Host level only. Through rookery serve it needs the role operate.

Arguments

NameWhereRequiredDescription
unitpathyesA unit's name, such as ssh.service. Only the configured units.
verbpathyesstart, stop, restart, reload, enable or disable.

Result

FieldTypeDescription
okboolean
Request
{
  "id": 1,
  "op": "units.act",
  "args": {
    "unit": "rookeryd.service",
    "verb": "restart"
  }
}
Reply
{
  "id": 1,
  "result": {
    "ok": true
  }
}

Types

The named types used on this page.

Unit

FieldTypeDescription
activestring
descriptionstring
loadstring
substring
unitstring

On this page