init
This commit is contained in:
commit
c5cd492449
475 changed files with 27928 additions and 0 deletions
35
technology/tools/Ansible/modules/ansible.builtin.tempfile.md
Normal file
35
technology/tools/Ansible/modules/ansible.builtin.tempfile.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# ansible.builtin.tempfile
|
||||
The `tempfile` module creates temporary files and directories.
|
||||
|
||||
## Parameter
|
||||
| Parameter | Type | Default | Description |
|
||||
| ---------- | --------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| **path** | path | - | Location where temporary file or directory should be created. If path is not specified, the default system temporary directory will be used. |
|
||||
| **prefix** | string | "ansible." | Prefix of file/directory name created by module. |
|
||||
| **state** | "directory"<br>"file" | "file" | Whether to create file or directory. |
|
||||
| **suffix** | string | "" | Suffix of file/directory name created by module. |
|
||||
|
||||
## Return Values
|
||||
| Value | Type | When | Description |
|
||||
| -------- | ------ | ------- | ---------------------------------- |
|
||||
| **path** | string | success | Path to created file or directory. |
|
||||
|
||||
## Examples
|
||||
```yaml
|
||||
- name: Create temporary build directory
|
||||
ansible.builtin.tempfile:
|
||||
state: directory
|
||||
suffix: build
|
||||
|
||||
- name: Create temporary file
|
||||
ansible.builtin.tempfile:
|
||||
state: file
|
||||
suffix: temp
|
||||
register: tempfile_1
|
||||
|
||||
- name: Use the registered var and the file module to remove the temporary file
|
||||
ansible.builtin.file:
|
||||
path: "{{ tempfile_1.path }}"
|
||||
state: absent
|
||||
when: tempfile_1.path is defined
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue