Skip to content

file

!file

Category: files

Manage the state of a regular file on the target — create/touch, remove, or adjust attributes (owner/group/mode). Fails if the path is a directory.

Parameters

NameTypeRequiredDescription
pathpathyesAbsolute path of the file to manage.
removeboolnoRemove the file if it exists.
attributesmapnoFile attributes: owner, group, mode (octal, requires 0o or 0 prefix).

Examples

- !file
  path: /var/lib/app/installed
  attributes:
    owner: app
    mode: '0o644'