Skip to content

File

The builtin.file resource allows you to create or delete a file, and to set content inside of a file.

Resource parameters

NameDescriptionRequiredDefault
pathPath to the file you want to managetrue
ownerSet owner of the filefalseroot
groupSet group of the filefalseroot
modeSet mode of the filefalse0755
contentSet content of the filefalse

Examples

Create a file at path /tmp/hello_world with content Hello, world!

yaml
- title: "Create file /tmp/hello_world"
  type: "builtin.file"
  present: true
  data:
    path: "/tmp/hello_world"
    content: "Hello, world!"

Delete a file at path /tmp/delete_me

yaml
- title: "Delete file /tmp/delete_me"
  type: "builtin.file"
  present: false
  data:
    path: "/tmp/delete_me"