ansible.windows.win_tempfile (2.3.0) — module

Creates temporary files and directories

Authors: Dag Wieers (@dagwieers)

Install collection

Install with ansible-galaxy collection install ansible.windows:==2.3.0


Add to requirements.yml

  collections:
    - name: ansible.windows
      version: 2.3.0

Description

Creates temporary files and directories.

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create temporary build directory
  ansible.windows.win_tempfile:
    state: directory
    suffix: build
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create temporary file
  ansible.windows.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:
    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