.. _file: file ```````` .. versionadded:: 0.1 Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules support the same options as the file module - including ``copy``, ``template``, and ``assmeble``. .. raw:: html
parameter | required | default | choices | comments |
dest | True | [] | defines the file being managed, unless when used with state=link, and then sets the destination to create a symbolic link to using src | |
state | False | file |
|
If directory, all immediate subdirectories will be created if they do not exist. If file, the file will NOT be created if it does not exist, see the copy or template module if you want that behavior. If link, the symbolic link will be created or changed. If absent, directories will be recursively deleted, and files or symlinks will be unlinked. |
mode | False | mode the file or directory should be, such as 0644 as would be fed to chmod. English modes like g+x are not yet supported |
Example from Ansible Playbooks
file path=/etc/foo.conf owner=foo group=foo mode=0644