line

manage one line in a file

Keys

KeyTypeDefaultMeaning
pathstringrequiredabsolute
linestring-line to keep
matchstringrequiredregular expression for the line
validatestring-check command, as for file
absentbooleanfalseremove the matching lines

line.path

string, required

Absolute. A missing file is a change in the plan, since an earlier step can create it. Apply fails when it is still missing.

line.line

string

Line to keep. It replaces the one line that match finds, or goes at the end of the file.

line.match

string, required

Regular expression for the line. More than one matching line fails the check.

line.validate

string

Check command, as for file. It runs with absent too.

line.absent

boolean, default false

Remove the matching lines.

Example

- line:
    path: /etc/default/grub
    match: ^GRUB_TIMEOUT=
    line: GRUB_TIMEOUT=2
  then: update-grub