Windows_Files Operations

The windows_files module handles windows filesystem state, file uploads and template generation.

windows_files.directory

Add/remove/update directories.

windows_files.directory(
    name, present=True, assume_present=False, user=None, group=None, mode=None,
    recursive=False,
)
  • name: name/path of the remote folder
  • present: whether the folder should exist
  • assume_present: whether to assume the directory exists
  • TODO: user: user to own the folder
  • TODO: group: group to own the folder
  • TODO: mode: permissions of the folder
  • TODO: recursive: recursively apply user/group/mode

Examples:

files.directory(
    name='Ensure the c:\temp\dir_that_we_want_removed is removed',
    path='c:\temp\dir_that_we_want_removed',
    present=False,
)

files.directory(
    name='Ensure c:\temp\foo\foo_dir exists',
    path='c:\temp\foo\foo_dir',
    recursive=True,
)

# multiple directories
dirs = ['c:\temp\foo_dir1', 'c:\temp\foo_dir2']
for dir in dirs:
    files.directory(
        name='Ensure the directory `{}` exists'.format(dir),
        path=dir,
    )

windows_files.file

Add/remove/update files.

windows_files.file(
    name, present=True, assume_present=False, user=None, group=None, mode=None, touch=False,
    create_remote_dir=True,
)
  • name: name/path of the remote file
  • present: whether the file should exist
  • assume_present: whether to assume the file exists
  • TODO: user: user to own the files
  • TODO: group: group to own the files
  • TODO: mode: permissions of the files as an integer, eg: 755
  • touch: whether to touch the file
  • create_remote_dir: create the remote directory if it doesn’t exist
create_remote_dir:
If the remote directory does not exist it will be created using the same user & group as passed to files.put. The mode will not be copied over, if this is required call files.directory separately.

Example:

files.file(
    name='Create c:\temp\hello.txt',
    path='c:\temp\hello.txt',
    touch=True,
)