dir

manage a directory

The step creates missing parent directories, owned by root with mode 0755. winch checks owner, group, and mode on every run.

Keys

KeyTypeDefaultMeaning
pathstringrequiredabsolute
ownername or IDroot
groupname or IDroot
modestring0755octal, in quotes
recursebooleanfalseowner and group for the whole tree
absentbooleanfalseremove it with its content
replacebooleanfalseremove another kind of thing at path first
purgebooleanfalseremove entries that nothing declares
keeplist of strings-name patterns that purge keeps

dir.path

string, required

Absolute. The step creates missing parent directories, owned by root with mode 0755. It follows a symbolic link to a directory and manages the directory behind it.

dir.owner

name or ID, default root

A user name, or a numeric ID that needs no account. A value of only digits is an ID, also in quotes.

dir.group

name or ID, default root

A group name, or a numeric ID that needs no group. A value of only digits is an ID, also in quotes.

dir.mode

string, default 0755

Octal, in quotes: "0750". Without quotes, YAML reads it as a number.

dir.recurse

boolean, default false

Owner and group for the whole tree. The mode stays the mode of the directory alone. The plan fails when another step gives a path in the tree another owner or group; a file with content and no owner counts as root.

dir.absent

boolean, default false

Remove it with its content.

dir.replace

boolean, default false

Remove another kind of thing at path first, such as a file or a link. Without it, such a thing fails the check.

dir.purge

boolean, default false

Remove entries that nothing declares. Purge looks only at the direct entries. It keeps an entry that a package owns, or that a step for the host writes. Each removal is a change.

dir.keep

list of strings

Name patterns that purge keeps, such as *.db. They are glob patterns. keep needs purge.

Example

- dir:
    path: /var/www/app
    owner: www-data
    group: www-data
    mode: "0750"