Files
docs.grlx.dev/content/docs/Recipe Ingredients/file.md
2023-10-19 11:45:41 -04:00

1.7 KiB

title
title
grlx.ingredients.file

file.absent

Deletes a file or directory

Parameters

  • name (string,required): the name/path of the file to delete

Example

file.absent:
    name: ~/.config/sytemd/user/backup.service

file.append

Appends content to a file. Only appends the content if it doesn't exist.

Parameters

  • name (string,required): the name/path of the file to delete
  • text (string,required): the text to append to a file

Example

file.append:
  - name: /etc/profile
  - text: |
      export PATH=$PATH:/usr/local/go/bin

file.contains

Checks if a file contains a given selection. If multiple sources are provided, all must be satisfied.

Parameters

  • name (string,required): the name/path of the file to check
  • text (string): the item to search for
  • source (string): a file source (such as HTTP, file, etc.) to reference
  • source_hash (string): a hash for a given source
  • sources (list): a list of sources to check against
  • source_hashes (list): a list of source hashes
  • skip_verify (boolean): whether to skip hash validation, false by default

file.directory

Handles many directory operations. Ensures that a directory exists with the given permissions.

Parameters

  • name (string,required): the name/path of the directory
  • makedirs (bool): option to make directory if it doesn't exist, defaults to true
  • user (string): the user who will own the directory
  • group (string): the group who will own the directory
  • dir_mode (string): the directory mode
  • file_mode (string): the file mode to set
  • recurse (bool): whether to recurse the directories and apply permissions

Example