file_block_present

Ensure that a text block is present in a specific location.

⚙️ Compatible targets: Linux

Parameters

NameDocumentation
pathFile name to edit (absolute path on the target node).

This parameter is required.
blockBlock(s) to add in the file.

This parameter is required.

Example

method: file_block_present
params:
  path: VALUE
  block: VALUE

Documentation

Ensure that a text block is present in the target file. If the block is not found, it will be added at the end of the file.

Examples:

Given a file with the following content:

apple
pear
banana

Applying the method with the block:

pear
orange

Will result in the following content:

apple
pear
banana
pear
orange