ansible.builtin.win_tempfile (v2.9.27) — module

Creates temporary files and directories

| "added in version" 2.3 of ansible.builtin"

Authors: Dag Wieers (@dagwieers)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Creates temporary files and directories.

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create temporary build directory
  win_tempfile:
    state: directory
    suffix: build
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create temporary file
  win_tempfile:
    state: file
    suffix: temp

Inputs

    
path:
    aliases:
    - dest
    default: '%TEMP%'
    description:
    - Location where temporary file or directory should be created.
    - If path is not specified default system temporary directory (%TEMP%) will be used.
    type: path

state:
    choices:
    - directory
    - file
    default: file
    description:
    - Whether to create file or directory.
    type: str

prefix:
    default: ansible.
    description:
    - Prefix of file/directory name created by module.
    type: str

suffix:
    default: ''
    description:
    - Suffix of file/directory name created by module.
    type: str

Outputs

path:
  description: The absolute path to the created file or directory.
  returned: success
  sample: C:\Users\Administrator\AppData\Local\Temp\ansible.bMlvdk
  type: str

See also