Documentation

    PLEASE NOTE: This document applies to v1.4 version and not to the latest stable release v2.7

    Documentation for other releases can be found by using the version selector in the left bottom of any doc page.

    file

    Manage files and file properties.

    Attributes

    check_mode:
      support: full
    

    Parameters

    Parameter Required Type Values Description
    mode   string   Permissions of the destination file or directory.
    path true string   Absolute path to the file being managed.
    state   string absent
    directory
    file
    touch
    If absent, directories will be recursively deleted, and files or symlinks will be unlinked. If directory, all intermediate subdirectories will be created if they do not exist. If file, with no other options, returns the current state of path. If file, even with other options (such as mode), the file will be modified if it exists but will NOT be created if it does not exist. If touch, an empty file will be created if the file does not exist

    Example

    - file:
        path: /work
        state: absent
    
    - file:
        path: /yea
        state: present
        mode: 0644