Systemd

kind: systemd

sourceconditiontarget

Description

source

The Systemd "source" retrieves information from a systemd configuration file.

condition

The Systemd "condition" tests that an information exist in a systemd configuration file.

target

The Systemd "target" ensures that a systemd configuration file contains a specific value at a location.

Important
Updatecli will drop all comments in the system configuration file. Feel free to report an issue if you need to keep comments in the systemd configuration file.

Parameters

NameTypeDescriptionRequired
filestring

file specifies the systemd unit file path to manipulate

compatible: * source * condition * target

remark: * supports absolute or relative path

indexinteger

index specifies which matching option to read or update when the same option is defined multiple times. It starts at 0, so index 0 selects the first match, index 1 selects the second match, and so on. If unset then a condition or a target matches every occurrences.

compatible: * source * condition * target

default: 0

optionstring

option specifies the key within the section to read or update, such as “ExecStart”.

compatible: * source * condition * target

sectionstring

section specifies the unit file section to interact with, such as “Unit”, “Service”,

compatible: * source * condition * target

valuestring

value specifies the value for a specific option.

compatible: * condition * target

default: When used from a condition or a target, the default value is set to the associated source output.

Example

# updatecli.yaml
sources:
  default:
    name: Get value from systemd configuration
    kind: systemd
    spec:
      file: "wg.container"
      section: "Container"
      option: Image

conditions:
  default:
    name: Test if source output exist in systemd configuration
    kind: systemd
    spec:
      file: "wg.container"
      section: "Container"
      option: Image

targets:
  default:
    name: Update systemd configuration
    kind: systemd
    disablesourceinput: true
    spec:
      file: "wg.container"
      section: "Container"
      option: Volume
      value: "xxx"
Top