Skip to content

template

!template

Category: files

Render a local template, optionally composing sorted include_dir fragments, and install it atomically on the execution target. Preserve existing file metadata unless explicitly overridden.

Parameters

NameTypeRequiredDescription
srcstringyesLocal template filename (looked up under the templates directory).
destpathyesRemote destination path for the rendered file.
validatestringnoTarget-side validator command with exactly one standalone {} candidate argument; no shell syntax. Plan never runs it.
chdirpathnoAbsolute execution-target working directory for validation and file operations.
attributesmapnoFile attributes applied to the rendered file: owner, group, mode.

Examples

- !template
  src: nginx.conf.j2
  dest: /etc/nginx/nginx.conf