win_tempfile – Creates temporary files and directories — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# win_tempfile – Creates temporary files and directories

- Synopsis

- Parameters

- See Also

- Examples

- Return Values

- Status

## Synopsis

- Creates temporary files and directories.

- For non-Windows targets, please use the tempfile module instead.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
path path | Default: "%TEMP%" | Location where temporary file or directory should be created. If path is not specified default system temporary directory (%TEMP%) will be used. aliases: dest
prefix string | Default: "ansible." | Prefix of file/directory name created by module.
state string | Choices: directory file ← | Whether to create file or directory.
suffix string | Default: "" | Suffix of file/directory name created by module.

## See Also

See also

tempfile – Creates temporary files and directories

  The official documentation on the tempfile module.

## Examples

    - name: Create temporary build directory
      win_tempfile:
        state: directory
        suffix: build

    - name: Create temporary file
      win_tempfile:
        state: file
        suffix: temp

## Return Values

Common return values are documented here, the following are the fields unique to this module:

Key | Returned | Description
--- | --- | ---
path string | success | The absolute path to the created file or directory. Sample: C:\Users\Administrator\AppData\Local\Temp\ansible.bMlvdk

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]

- This module is maintained by the Ansible Community. [community]

### Authors

- Dag Wieers (@dagwieers)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.