2017-02-20 11:48:55 +00:00
|
|
|
#!/usr/bin/python
|
2017-05-07 19:59:35 +00:00
|
|
|
# coding: utf-8 -*-
|
2017-02-20 11:48:55 +00:00
|
|
|
|
2018-07-17 21:29:05 +00:00
|
|
|
# Copyright: (c) 2017, Dag Wieers <dag@wieers.com>
|
2018-02-25 02:09:54 +00:00
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
2017-02-20 11:48:55 +00:00
|
|
|
|
2017-08-16 03:16:38 +00:00
|
|
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
2017-03-14 16:07:22 +00:00
|
|
|
'status': ['preview'],
|
|
|
|
'supported_by': 'community'}
|
|
|
|
|
2017-02-20 11:48:55 +00:00
|
|
|
DOCUMENTATION = r'''
|
|
|
|
---
|
|
|
|
module: win_tempfile
|
|
|
|
version_added: "2.3"
|
2018-02-25 02:09:54 +00:00
|
|
|
short_description: Creates temporary files and directories
|
2017-02-20 11:48:55 +00:00
|
|
|
description:
|
|
|
|
- Creates temporary files and directories.
|
2017-06-26 15:26:53 +00:00
|
|
|
- For non-Windows targets, please use the M(tempfile) module instead.
|
2017-02-20 11:48:55 +00:00
|
|
|
options:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
- Whether to create file or directory.
|
2019-01-03 16:50:44 +00:00
|
|
|
type: str
|
2018-02-25 02:09:54 +00:00
|
|
|
choices: [ directory, file ]
|
2017-02-20 11:48:55 +00:00
|
|
|
default: file
|
|
|
|
path:
|
|
|
|
description:
|
|
|
|
- Location where temporary file or directory should be created.
|
|
|
|
- If path is not specified default system temporary directory (%TEMP%) will be used.
|
2018-07-17 21:29:05 +00:00
|
|
|
type: path
|
2017-02-20 11:48:55 +00:00
|
|
|
default: '%TEMP%'
|
|
|
|
prefix:
|
|
|
|
description:
|
|
|
|
- Prefix of file/directory name created by module.
|
2019-01-03 16:50:44 +00:00
|
|
|
type: str
|
2017-02-20 11:48:55 +00:00
|
|
|
default: ansible.
|
|
|
|
suffix:
|
|
|
|
description:
|
|
|
|
- Suffix of file/directory name created by module.
|
2019-01-03 16:50:44 +00:00
|
|
|
type: str
|
2017-02-20 11:48:55 +00:00
|
|
|
default: ''
|
2018-12-15 02:23:59 +00:00
|
|
|
seealso:
|
|
|
|
- module: tempfile
|
|
|
|
author:
|
|
|
|
- Dag Wieers (@dagwieers)
|
2017-02-20 11:48:55 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = r"""
|
|
|
|
- name: Create temporary build directory
|
|
|
|
win_tempfile:
|
|
|
|
state: directory
|
|
|
|
suffix: build
|
|
|
|
|
|
|
|
- name: Create temporary file
|
|
|
|
win_tempfile:
|
|
|
|
state: file
|
|
|
|
suffix: temp
|
|
|
|
"""
|
|
|
|
|
|
|
|
RETURN = r'''
|
|
|
|
path:
|
2019-01-03 16:50:44 +00:00
|
|
|
description: Path to created file or directory.
|
2017-02-20 11:48:55 +00:00
|
|
|
returned: success
|
2018-12-18 21:25:30 +00:00
|
|
|
type: str
|
2017-02-20 11:48:55 +00:00
|
|
|
sample: C:\Users\Administrator\AppData\Local\Temp\ansible.bMlvdk
|
|
|
|
'''
|