blob: f4ab9998a669da31f5debfbc0284e04783f8674d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
- name: Ensure that dest top directory doesn't exist
file:
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
state: absent
- name: Copy file, dest is a file in non-existing target directory
copy:
src: foo.txt
dest: '{{ remote_dir }}/{{ dest }}'
register: copy_result
ignore_errors: True
- name: Assert copy failed
assert:
that:
- 'copy_result is failed'
- name: Stat dest path
stat:
path: '{{ remote_dir }}/{{ dest.split("/")[0] }}'
register: stat_file_in_dir_result
- name: assert that dest doesn't exist
assert:
that:
- 'not stat_file_in_dir_result.stat.exists'
|