@ -30,30 +30,43 @@
- name : Test tempdir is removed
hosts : testhost
gather_facts : false
vars:
# These tests cannot be run with pipelining as it defeats the purpose of
# ensuring remote_tmp is cleaned up. Pipelining is enabled in the test
# inventory
ansible_pipelining : false
# Ensure that the remote_tmp_dir we create allows the unpriv connection user
# to create the remote_tmp
ansible_become : false
tasks:
- import_role:
name : ../setup_remote_tmp_dir
- file:
state : touch
path : "{{ remote_tmp_dir }}/65393"
- vars:
# Isolate the remote_tmp used by these tests
ansible_remote_tmp : "{{ remote_tmp_dir }}/remote_tmp"
block:
- file:
state : touch
path : "{{ remote_tmp_dir }}/65393"
- copy:
src : "{{ remote_tmp_dir }}/65393"
dest : "{{ remote_tmp_dir }}/65393.2"
remote_src : true
- copy:
src : "{{ remote_tmp_dir }}/65393"
dest : "{{ remote_tmp_dir }}/65393.2"
remote_src : true
- find:
path : "~/.ansible/tmp "
use_regex : yes
patterns : 'AnsiballZ_.+\.py'
recurse : true
register : result
- find:
path : "{{ ansible_remote_tmp }} "
use_regex : yes
patterns : 'AnsiballZ_.+\.py'
recurse : true
register : result
- debug:
var : result
- assert:
that:
# Should find nothing since pipelining is used
- result.files|length == 0
# Should only be AnsiballZ_find.py because find is actively running
- result.files|length == 1
- result.files[0].path.endswith('/AnsiballZ_find.py')