Skip to main content
file(path) reads the file at path and returns its contents as a UTF-8 string. The path is relative to the playbook’s working directory.

Signature

Example

Read a version from a dedicated file and use it across the playbook:

Notes

  • If the file does not exist or cannot be read, Errand reports an error at evaluation time.
  • The file contents are read as-is, including any trailing newline. Use trimspace or chomp to strip it.
  • For binary files, use filebase64 to read as base64-encoded string.
  • To check whether a file exists before reading it, use fileexists in a condition.