community.openwrt.tempfile module – Creates temporary files and directories on OpenWrt nodes

Note

This module is part of the community.openwrt collection (version 1.1.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.openwrt.

To use it in a playbook, specify: community.openwrt.tempfile.

New in community.openwrt 1.1.0

Synopsis

Note

This module has a corresponding action plugin.

Parameters

Parameter

Comments

path

path

Location where the temporary file or directory should be created.

Default: "/tmp"

prefix

string

Prefix of the file or directory name.

Default: "ansible"

state

string

Whether to create a file or a directory.

Choices:

  • "file" ← (default)

  • "directory"

Attributes

Attribute

Support

Description

check_mode

Support: full

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Returns details on what has changed (or possibly needs changing in check_mode), when in diff mode.

platform

Platform: OpenWrt

Target platform for this module.

Notes

Note

  • This module always returns changed=true because it creates a new temporary file or directory each time it runs.

Examples

- name: Create temporary file
  community.openwrt.tempfile:
    state: file
  register: temp_file_1

- name: Create temporary directory with `build` prefix
  community.openwrt.tempfile:
    state: directory
    prefix: build
  register: temp_dir_1

Return Values

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

Key

Description

path

string

The absolute path to the created file or directory.

Returned: success

Sample: "/tmp/ansible.bMlvdk"

Authors

  • Ilya Bogdanov (@zeerayne)