mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-12 09:04:21 -07:00
* Remove superfluous test.
* Use remote_temp_dir instead of output_dir on remote.
* Read certificate from correct place.
* Adjust more places.
* Fix boolean.
* Improve cryptography setup.
* Fix java_keystore changes.
* Need to copy binary from remote.
* Use correct Python for serve script.
* Sleep before downloading.
* Use correct Python interpreter.
* Avoid failing shebang test.
* Fix permission error with macOS 11.1.
* Avoid shebang trouble.
(cherry picked from commit 7c43cc3faa
)
This commit is contained in:
parent
3735ee6df7
commit
da0738badf
62 changed files with 392 additions and 376 deletions
|
@ -2,21 +2,21 @@
|
|||
- name: Create broken link
|
||||
file:
|
||||
src: /nowhere
|
||||
dest: "{{ output_dir }}/nowhere.txt"
|
||||
dest: "{{ remote_tmp_dir }}/nowhere.txt"
|
||||
state: link
|
||||
force: yes
|
||||
|
||||
- name: Archive broken link (tar.gz)
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_broken_link.tar.gz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.gz"
|
||||
|
||||
- name: Archive broken link (tar.bz2)
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_broken_link.tar.bz2"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_broken_link.tar.bz2"
|
||||
|
||||
- name: Archive broken link (zip)
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_broken_link.zip"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_broken_link.zip"
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
register: backports_lzma_pip
|
||||
|
||||
- name: prep our files
|
||||
copy: src={{ item }} dest={{output_dir}}/{{ item }}
|
||||
copy: src={{ item }} dest={{remote_tmp_dir}}/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -84,15 +84,15 @@
|
|||
|
||||
- name: archive using gz
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.gz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_01.gz"
|
||||
format: gz
|
||||
register: archive_gz_result_01
|
||||
|
||||
- debug: msg="{{ archive_gz_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.gz state=file
|
||||
file: path={{remote_tmp_dir}}/archive_01.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files
|
||||
assert:
|
||||
|
@ -103,15 +103,15 @@
|
|||
|
||||
- name: archive using zip
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.zip"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_01.zip"
|
||||
format: zip
|
||||
register: archive_zip_result_01
|
||||
|
||||
- debug: msg="{{ archive_zip_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.zip state=file
|
||||
file: path={{remote_tmp_dir}}/archive_01.zip state=file
|
||||
|
||||
- name: check if zip file exists
|
||||
assert:
|
||||
|
@ -122,15 +122,15 @@
|
|||
|
||||
- name: archive using bz2
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.bz2"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_01.bz2"
|
||||
format: bz2
|
||||
register: archive_bz2_result_01
|
||||
|
||||
- debug: msg="{{ archive_bz2_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.bz2 state=file
|
||||
file: path={{remote_tmp_dir}}/archive_01.bz2 state=file
|
||||
|
||||
- name: check if bzip file exists
|
||||
assert:
|
||||
|
@ -141,15 +141,15 @@
|
|||
|
||||
- name: archive using xz
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_01.xz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_01.xz"
|
||||
format: xz
|
||||
register: archive_xz_result_01
|
||||
|
||||
- debug: msg="{{ archive_xz_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_01.xz state=file
|
||||
file: path={{remote_tmp_dir}}/archive_01.xz state=file
|
||||
|
||||
- name: check if xz file exists
|
||||
assert:
|
||||
|
@ -160,15 +160,15 @@
|
|||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.gz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_02.gz"
|
||||
format: gz
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_bz2_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.gz"
|
||||
path: "{{ remote_tmp_dir }}/archive_02.gz"
|
||||
register: archive_02_gz_stat
|
||||
|
||||
- debug: msg="{{ archive_02_gz_stat}}"
|
||||
|
@ -182,20 +182,20 @@
|
|||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_02.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_02.gz" state=absent
|
||||
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.zip"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_02.zip"
|
||||
format: zip
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_zip_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.zip"
|
||||
path: "{{ remote_tmp_dir }}/archive_02.zip"
|
||||
register: archive_02_zip_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
|
@ -207,20 +207,20 @@
|
|||
- "{{ archive_zip_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our zip
|
||||
file: path="{{ output_dir }}/archive_02.zip" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_02.zip" state=absent
|
||||
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.bz2"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_02.bz2"
|
||||
format: bz2
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_bz2_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.bz2"
|
||||
path: "{{ remote_tmp_dir }}/archive_02.bz2"
|
||||
register: archive_02_bz2_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
|
@ -232,19 +232,19 @@
|
|||
- "{{ archive_bz2_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our bz2
|
||||
file: path="{{ output_dir }}/archive_02.bz2" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_02.bz2" state=absent
|
||||
|
||||
- name: archive and set mode to 0600
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_02.xz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_02.xz"
|
||||
format: xz
|
||||
mode: "u+rwX,g-rwx,o-rwx"
|
||||
register: archive_xz_result_02
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
stat:
|
||||
path: "{{ output_dir }}/archive_02.xz"
|
||||
path: "{{ remote_tmp_dir }}/archive_02.xz"
|
||||
register: archive_02_xz_stat
|
||||
|
||||
- name: Test that the file modes were changed
|
||||
|
@ -256,20 +256,20 @@
|
|||
- "{{ archive_xz_result_02['archived']| length}} == 3"
|
||||
|
||||
- name: remove our xz
|
||||
file: path="{{ output_dir }}/archive_02.xz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_02.xz" state=absent
|
||||
|
||||
- name: archive multiple files as list
|
||||
archive:
|
||||
path:
|
||||
- "{{ output_dir }}/empty.txt"
|
||||
- "{{ output_dir }}/foo.txt"
|
||||
- "{{ output_dir }}/bar.txt"
|
||||
dest: "{{ output_dir }}/archive_list.gz"
|
||||
- "{{ remote_tmp_dir }}/empty.txt"
|
||||
- "{{ remote_tmp_dir }}/foo.txt"
|
||||
- "{{ remote_tmp_dir }}/bar.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_list.gz"
|
||||
format: gz
|
||||
register: archive_gz_list_result
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{output_dir}}/archive_list.gz state=file
|
||||
file: path={{remote_tmp_dir}}/archive_list.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files
|
||||
assert:
|
||||
|
@ -279,18 +279,18 @@
|
|||
- "{{ archive_gz_list_result['archived'] | length }} == 3"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_list.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_list.gz" state=absent
|
||||
|
||||
- name: test that gz archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
format: gz
|
||||
register: nonascii_result_0
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz"
|
||||
register: nonascii_stat0
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
|
@ -300,18 +300,18 @@
|
|||
- "nonascii_stat0.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.tar.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.tar.gz" state=absent
|
||||
|
||||
- name: test that bz2 archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
format: bz2
|
||||
register: nonascii_result_1
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2"
|
||||
register: nonascii_stat_1
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
|
@ -321,18 +321,18 @@
|
|||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.bz2" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.bz2" state=absent
|
||||
|
||||
- name: test that xz archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
format: xz
|
||||
register: nonascii_result_1
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz"
|
||||
register: nonascii_stat_1
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
|
@ -342,18 +342,18 @@
|
|||
- "nonascii_stat_1.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.xz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.xz" state=absent
|
||||
|
||||
- name: test that zip archive that contains non-ascii filenames
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
format: zip
|
||||
register: nonascii_result_2
|
||||
|
||||
- name: Check that file is really there
|
||||
stat:
|
||||
path: "{{ output_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
path: "{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip"
|
||||
register: nonascii_stat_2
|
||||
|
||||
- name: Assert that nonascii tests succeeded
|
||||
|
@ -363,32 +363,32 @@
|
|||
- "nonascii_stat_2.stat.exists == true"
|
||||
|
||||
- name: remove nonascii test
|
||||
file: path="{{ output_dir }}/test-archive-nonascii-くらとみ.zip" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/test-archive-nonascii-くらとみ.zip" state=absent
|
||||
|
||||
- name: Test that excluded paths do not influence archive root
|
||||
archive:
|
||||
path:
|
||||
- "{{ output_dir }}/sub/subfile.txt"
|
||||
- "{{ output_dir }}"
|
||||
- "{{ remote_tmp_dir }}/sub/subfile.txt"
|
||||
- "{{ remote_tmp_dir }}"
|
||||
exclude_path:
|
||||
- "{{ output_dir }}"
|
||||
dest: "{{ output_dir }}/test-archive-root.tgz"
|
||||
- "{{ remote_tmp_dir }}"
|
||||
dest: "{{ remote_tmp_dir }}/test-archive-root.tgz"
|
||||
register: archive_root_result
|
||||
|
||||
- name: Assert that excluded paths do not influence archive root
|
||||
assert:
|
||||
that:
|
||||
- archive_root_result.arcroot != output_dir
|
||||
- archive_root_result.arcroot != remote_tmp_dir
|
||||
|
||||
- name: Remove archive root test
|
||||
file:
|
||||
path: "{{ output_dir }}/test-archive-root.tgz"
|
||||
path: "{{ remote_tmp_dir }}/test-archive-root.tgz"
|
||||
state: absent
|
||||
|
||||
- name: Test Single Target with format={{ item }}
|
||||
archive:
|
||||
path: "{{ output_dir }}/foo.txt"
|
||||
dest: "{{ output_dir }}/test-single-target.{{ item }}"
|
||||
path: "{{ remote_tmp_dir }}/foo.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-single-target.{{ item }}"
|
||||
format: "{{ item }}"
|
||||
register: "single_target_test"
|
||||
loop:
|
||||
|
@ -410,7 +410,7 @@
|
|||
|
||||
- name: Retrieve contents of single target archives
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ output_dir }}/test-single-target.zip"
|
||||
src: "{{ remote_tmp_dir }}/test-single-target.zip"
|
||||
dest: .
|
||||
list_files: true
|
||||
check_mode: true
|
||||
|
@ -427,7 +427,7 @@
|
|||
|
||||
- name: Remove single target test with format={{ item }}
|
||||
file:
|
||||
path: "{{ output_dir }}/test-single-target.{{ item }}"
|
||||
path: "{{ remote_tmp_dir }}/test-single-target.{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- zip
|
||||
|
@ -439,22 +439,22 @@
|
|||
- name: Test that missing files result in incomplete state
|
||||
archive:
|
||||
path:
|
||||
- "{{ output_dir }}/*.txt"
|
||||
- "{{ output_dir }}/dne.txt"
|
||||
exclude_path: "{{ output_dir }}/foo.txt"
|
||||
dest: "{{ output_dir }}/test-incomplete-archive.tgz"
|
||||
- "{{ remote_tmp_dir }}/*.txt"
|
||||
- "{{ remote_tmp_dir }}/dne.txt"
|
||||
exclude_path: "{{ remote_tmp_dir }}/foo.txt"
|
||||
dest: "{{ remote_tmp_dir }}/test-incomplete-archive.tgz"
|
||||
register: incomplete_archive_result
|
||||
|
||||
- name: Assert that incomplete archive has incomplete state
|
||||
assert:
|
||||
that:
|
||||
- incomplete_archive_result is changed
|
||||
- "'{{ output_dir }}/dne.txt' in incomplete_archive_result.missing"
|
||||
- "'{{ output_dir }}/foo.txt' not in incomplete_archive_result.missing"
|
||||
- "'{{ remote_tmp_dir }}/dne.txt' in incomplete_archive_result.missing"
|
||||
- "'{{ remote_tmp_dir }}/foo.txt' not in incomplete_archive_result.missing"
|
||||
|
||||
- name: Remove incomplete archive
|
||||
file:
|
||||
path: "{{ output_dir }}/test-incomplete-archive.tgz"
|
||||
path: "{{ remote_tmp_dir }}/test-incomplete-archive.tgz"
|
||||
state: absent
|
||||
|
||||
- name: Remove backports.lzma if previously installed (pip)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
- name: archive using gz and remove src files
|
||||
archive:
|
||||
path: "{{ output_dir }}/*.txt"
|
||||
dest: "{{ output_dir }}/archive_remove_01.gz"
|
||||
path: "{{ remote_tmp_dir }}/*.txt"
|
||||
dest: "{{ remote_tmp_dir }}/archive_remove_01.gz"
|
||||
format: gz
|
||||
remove: yes
|
||||
register: archive_remove_result_01
|
||||
|
@ -10,7 +10,7 @@
|
|||
- debug: msg="{{ archive_remove_result_01 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{ output_dir }}/archive_remove_01.gz state=file
|
||||
file: path={{ remote_tmp_dir }}/archive_remove_01.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files and src files has been removed
|
||||
assert:
|
||||
|
@ -20,19 +20,19 @@
|
|||
- "{{ archive_remove_result_01['archived'] | length }} == 3"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_remove_01.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_remove_01.gz" state=absent
|
||||
|
||||
- name: check if src files has been removed
|
||||
assert:
|
||||
that:
|
||||
- "'{{ output_dir }}/{{ item }}' is not exists"
|
||||
- "'{{ remote_tmp_dir }}/{{ item }}' is not exists"
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
- empty.txt
|
||||
|
||||
- name: prep our files again
|
||||
copy: src={{ item }} dest={{ output_dir }}/{{ item }}
|
||||
copy: src={{ item }} dest={{ remote_tmp_dir }}/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -40,11 +40,11 @@
|
|||
|
||||
- name: create a temporary directory to be check if it will be removed
|
||||
file:
|
||||
path: "{{ output_dir }}/tmpdir"
|
||||
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||
state: directory
|
||||
|
||||
- name: prep our files in tmpdir
|
||||
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }}
|
||||
copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -52,8 +52,8 @@
|
|||
|
||||
- name: archive using gz and remove src directory
|
||||
archive:
|
||||
path: "{{ output_dir }}/tmpdir"
|
||||
dest: "{{ output_dir }}/archive_remove_02.gz"
|
||||
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||
dest: "{{ remote_tmp_dir }}/archive_remove_02.gz"
|
||||
format: gz
|
||||
remove: yes
|
||||
register: archive_remove_result_02
|
||||
|
@ -61,7 +61,7 @@
|
|||
- debug: msg="{{ archive_remove_result_02 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{ output_dir }}/archive_remove_02.gz state=file
|
||||
file: path={{ remote_tmp_dir }}/archive_remove_02.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files
|
||||
assert:
|
||||
|
@ -71,20 +71,20 @@
|
|||
- "{{ archive_remove_result_02['archived'] | length }} == 3"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_remove_02.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_remove_02.gz" state=absent
|
||||
|
||||
- name: check if src folder has been removed
|
||||
assert:
|
||||
that:
|
||||
- "'{{ output_dir }}/tmpdir' is not exists"
|
||||
- "'{{ remote_tmp_dir }}/tmpdir' is not exists"
|
||||
|
||||
- name: create temporary directory again
|
||||
file:
|
||||
path: "{{ output_dir }}/tmpdir"
|
||||
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||
state: directory
|
||||
|
||||
- name: prep our files in tmpdir again
|
||||
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }}
|
||||
copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -92,17 +92,17 @@
|
|||
|
||||
- name: archive using gz and remove src directory excluding one file
|
||||
archive:
|
||||
path: "{{ output_dir }}/tmpdir/*"
|
||||
dest: "{{ output_dir }}/archive_remove_03.gz"
|
||||
path: "{{ remote_tmp_dir }}/tmpdir/*"
|
||||
dest: "{{ remote_tmp_dir }}/archive_remove_03.gz"
|
||||
format: gz
|
||||
remove: yes
|
||||
exclude_path: "{{ output_dir }}/tmpdir/empty.txt"
|
||||
exclude_path: "{{ remote_tmp_dir }}/tmpdir/empty.txt"
|
||||
register: archive_remove_result_03
|
||||
|
||||
- debug: msg="{{ archive_remove_result_03 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{ output_dir }}/archive_remove_03.gz state=file
|
||||
file: path={{ remote_tmp_dir }}/archive_remove_03.gz state=file
|
||||
|
||||
- name: check if gz file exists and includes all text files
|
||||
assert:
|
||||
|
@ -112,13 +112,13 @@
|
|||
- "{{ archive_remove_result_03['archived'] | length }} == 2"
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_remove_03.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_remove_03.gz" state=absent
|
||||
|
||||
- name: verify that excluded file is still present
|
||||
file: path={{ output_dir }}/tmpdir/empty.txt state=file
|
||||
file: path={{ remote_tmp_dir }}/tmpdir/empty.txt state=file
|
||||
|
||||
- name: prep our files in tmpdir again
|
||||
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }}
|
||||
copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -129,27 +129,27 @@
|
|||
- name: archive using gz and remove src directory
|
||||
archive:
|
||||
path:
|
||||
- "{{ output_dir }}/tmpdir/*.txt"
|
||||
- "{{ output_dir }}/tmpdir/sub/*"
|
||||
dest: "{{ output_dir }}/archive_remove_04.gz"
|
||||
- "{{ remote_tmp_dir }}/tmpdir/*.txt"
|
||||
- "{{ remote_tmp_dir }}/tmpdir/sub/*"
|
||||
dest: "{{ remote_tmp_dir }}/archive_remove_04.gz"
|
||||
format: gz
|
||||
remove: yes
|
||||
exclude_path: "{{ output_dir }}/tmpdir/sub/subfile.txt"
|
||||
exclude_path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
|
||||
register: archive_remove_result_04
|
||||
|
||||
- debug: msg="{{ archive_remove_result_04 }}"
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{ output_dir }}/archive_remove_04.gz state=file
|
||||
file: path={{ remote_tmp_dir }}/archive_remove_04.gz state=file
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_remove_04.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_remove_04.gz" state=absent
|
||||
|
||||
- name: verify that excluded sub file is still present
|
||||
file: path={{ output_dir }}/tmpdir/sub/subfile.txt state=file
|
||||
file: path={{ remote_tmp_dir }}/tmpdir/sub/subfile.txt state=file
|
||||
|
||||
- name: prep our files in tmpdir again
|
||||
copy: src={{ item }} dest={{ output_dir }}/tmpdir/{{ item }}
|
||||
copy: src={{ item }} dest={{ remote_tmp_dir }}/tmpdir/{{ item }}
|
||||
with_items:
|
||||
- foo.txt
|
||||
- bar.txt
|
||||
|
@ -160,19 +160,19 @@
|
|||
- name: archive using gz and remove src directory
|
||||
archive:
|
||||
path:
|
||||
- "{{ output_dir }}/tmpdir/"
|
||||
dest: "{{ output_dir }}/archive_remove_05.gz"
|
||||
- "{{ remote_tmp_dir }}/tmpdir/"
|
||||
dest: "{{ remote_tmp_dir }}/archive_remove_05.gz"
|
||||
format: gz
|
||||
remove: yes
|
||||
exclude_path: "{{ output_dir }}/tmpdir/sub/subfile.txt"
|
||||
exclude_path: "{{ remote_tmp_dir }}/tmpdir/sub/subfile.txt"
|
||||
register: archive_remove_result_05
|
||||
|
||||
- name: verify that the files archived
|
||||
file: path={{ output_dir }}/archive_remove_05.gz state=file
|
||||
file: path={{ remote_tmp_dir }}/archive_remove_05.gz state=file
|
||||
|
||||
- name: Verify source files were removed
|
||||
file:
|
||||
path: "{{ output_dir }}/tmpdir"
|
||||
path: "{{ remote_tmp_dir }}/tmpdir"
|
||||
state: absent
|
||||
register: archive_source_file_removal_05
|
||||
|
||||
|
@ -183,4 +183,4 @@
|
|||
- archive_source_file_removal_05 is not changed
|
||||
|
||||
- name: remove our gz
|
||||
file: path="{{ output_dir }}/archive_remove_05.gz" state=absent
|
||||
file: path="{{ remote_tmp_dir }}/archive_remove_05.gz" state=absent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue