file
Collection: builtin
Full Name: parallax.builtin.file
Aliases: ansible.builtin.file, file
Synopsis
Manage the state, ownership and permissions of files and directories
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| path | string | yes | Path to the file or directory | |
| state | string | file | State of the file (absent, directory, touch) | |
| mode | string | The permission mode of the file or directory | ||
| owner | string | Name of the user that should own the file | ||
| group | string | Name of the group that should own the file |
Example
- name: Ensure the application directory exists
file:
path: /srv/app
state: directory
owner: app
group: app
mode: "0750"
- name: Remove a stale lock file
file:
path: /var/run/app.lock
state: absent