directory
Purpose: ensure a directory exists (or is absent) with the desired owner, group, and mode.
Synopsis
Section titled “Synopsis”- id: appdir type: directory with: path: /opt/myapp mode: "0755" owner: root group: rootParameters
Section titled “Parameters”| 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". |
Expected behavior
Section titled “Expected behavior”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/modeare omitted.
Idempotency
Section titled “Idempotency”Fully idempotent.
Failure behavior
Section titled “Failure behavior”- Missing parent directory → failure (no implicit recursion).
- Unexpected symlink in the path → rejected before mutation.
Platform notes
Section titled “Platform notes”Applies to all supported targets.