mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
filesystem: create temp directory outside /tmp to avoid problems with tmpfs. (#5182)
This commit is contained in:
parent
766c109d47
commit
8027bc5335
5 changed files with 63 additions and 1 deletions
|
@ -5,4 +5,4 @@
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- setup_pkg_mgr
|
- setup_pkg_mgr
|
||||||
- setup_remote_tmp_dir
|
- setup_remote_tmp_dir_outside_tmp
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
# Copyright (c) Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
- name: delete temporary directory
|
||||||
|
include_tasks: default-cleanup.yml
|
||||||
|
|
||||||
|
- name: delete temporary directory (windows)
|
||||||
|
include_tasks: windows-cleanup.yml
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
# Copyright (c) Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
- name: delete temporary directory
|
||||||
|
file:
|
||||||
|
path: "{{ remote_tmp_dir }}"
|
||||||
|
state: absent
|
||||||
|
no_log: yes
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
# Copyright (c) Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
- name: create ~/tmp
|
||||||
|
file:
|
||||||
|
path: '~/tmp'
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- name: create temporary directory
|
||||||
|
tempfile:
|
||||||
|
state: directory
|
||||||
|
suffix: .test
|
||||||
|
path: ~/tmp
|
||||||
|
register: remote_tmp_dir
|
||||||
|
notify:
|
||||||
|
- delete temporary directory
|
||||||
|
|
||||||
|
- name: record temporary directory
|
||||||
|
set_fact:
|
||||||
|
remote_tmp_dir: "{{ remote_tmp_dir.path }}"
|
|
@ -0,0 +1,20 @@
|
||||||
|
---
|
||||||
|
####################################################################
|
||||||
|
# WARNING: These are designed specifically for Ansible tests #
|
||||||
|
# and should not be used as examples of how to write Ansible roles #
|
||||||
|
####################################################################
|
||||||
|
|
||||||
|
# Copyright (c) Ansible Project
|
||||||
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
- name: make sure we have the ansible_os_family and ansible_distribution_version facts
|
||||||
|
setup:
|
||||||
|
gather_subset: distribution
|
||||||
|
when: ansible_facts == {}
|
||||||
|
|
||||||
|
- include_tasks: "{{ lookup('first_found', files)}}"
|
||||||
|
vars:
|
||||||
|
files:
|
||||||
|
- "{{ ansible_os_family | lower }}.yml"
|
||||||
|
- "default.yml"
|
Loading…
Reference in a new issue