Skip to content

directory

Purpose: ensure a directory exists (or is absent) with the desired owner, group, and mode.

- id: appdir
type: directory
with:
path: /opt/myapp
mode: "0755"
owner: root
group: root
Parameter Required Type Default Description
path yes string (absolute path) — Managed directory path.
state no string present present or absent.
owner no string — Owner name.
group no string — Group name.
mode no string — Quoted four-digit octal, e.g. "0755".
  • present: creates exactly that directory — the parent must already exist (no recursive creation).
  • absent: removes the directory. Refuses non-empty directories and non-directory objects.
  • Metadata is preserved when owner/group/mode are omitted.

Fully idempotent.

  • Missing parent directory → failure (no implicit recursion).
  • Unexpected symlink in the path → rejected before mutation.

Applies to all supported targets.

file · link