New in version 1.9.2.
Creates (empty) files, updates file modification stamps of existing files, and can create or remove directories. Unlike file, does not modify ownership, permissions or manipulate links.
parameter | required | default | choices | comments |
---|---|---|---|---|
path | yes |
path to the file being managed. Aliases: dest, name
aliases: dest, name
|
||
state | no | 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 absent , directories will be recursively deleted, and files will be removed. If touch , an empty file will be created if the c(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way `touch` works from the command line). |
# create a file - win_file: path=C:\temp\foo.conf # touch a file (creates if not present, updates modification time if present) - win_file: path=C:\temp\foo.conf state=touch # remove a file, if present - win_file: path=C:\temp\foo.conf state=absent # create directory structure - win_file: path=C:\temp\folder\subfolder state=directory # remove directory structure - win_file: path=C:\temp state=absent
Note
See also win_copy, win_template, copy, template, assemble
For more information on what this means please read Core Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.
© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/win_file_module.html