|
|
@ -1,10 +1,11 @@
|
|
|
|
# src is a file, dest is a non-existent directory: checks that dest is created
|
|
|
|
# src is a file, dest is a non-existent directory (2 levels of directories):
|
|
|
|
- name: Ensure that dest directory doesn't exist
|
|
|
|
# checks that dest is created
|
|
|
|
|
|
|
|
- name: Ensure that dest top directory doesn't exist
|
|
|
|
file:
|
|
|
|
file:
|
|
|
|
path: '{{ remote_dir }}/new_sub_dir1/'
|
|
|
|
path: '{{ remote_dir }}/new_sub_dir1/'
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy file, dest is a non-existing target directory
|
|
|
|
- name: Copy file, dest is a nonexistent target directory
|
|
|
|
copy:
|
|
|
|
copy:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
|
|
|
|
dest: '{{ remote_dir }}/new_sub_dir1/{{ item.dest }}'
|
|
|
@ -16,12 +17,12 @@
|
|
|
|
- 'copy_result|success'
|
|
|
|
- 'copy_result|success'
|
|
|
|
- 'copy_result|changed'
|
|
|
|
- 'copy_result|changed'
|
|
|
|
|
|
|
|
|
|
|
|
- name: stat the copied path
|
|
|
|
- name: stat copied file
|
|
|
|
stat:
|
|
|
|
stat:
|
|
|
|
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
|
|
|
|
path: '{{ remote_dir }}/new_sub_dir1/sub_dir2/{{ item.check }}'
|
|
|
|
register: stat_file_in_dir_result
|
|
|
|
register: stat_file_in_dir_result
|
|
|
|
|
|
|
|
|
|
|
|
- name: assert that the file exists
|
|
|
|
- name: assert that file exists
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- stat_file_in_dir_result.stat.exists
|
|
|
|
- stat_file_in_dir_result.stat.exists
|