unit
manage a systemd unit file
A change of the file, also of its owner or mode, runs systemctl daemon-reload. daemon-reload does not restart a running unit. A handler with restarted: true does.
The step also checks an ok file: systemd can still need a reload, as after a run that wrote the file and then failed. Then the step runs daemon-reload as a change, so its handlers run. A template unit, such as app@.service, skips this check.
Keys
| Key | Type | Default | Meaning |
|---|---|---|---|
name | string | required | file name with its type |
source | string | - | file in the recipe's files/ |
content | string | - | unit file text |
unit.name
string, required
File name with its type, such as app.service or app@.service.
unit.source
string
File in the recipe's files/ directory. A step has source or content.
unit.content
string
Unit file text. A step has source or content.
Example
- unit:
name: app.service
content: |
[Unit]
Description=App
[Service]
ExecStart=/usr/local/bin/app
[Install]
WantedBy=multi-user.target