|
|
@ -16,6 +16,7 @@
|
|
|
|
copy:
|
|
|
|
copy:
|
|
|
|
src: foo.txt
|
|
|
|
src: foo.txt
|
|
|
|
dest: "{{ user.home }}/foo-unarchive.txt"
|
|
|
|
dest: "{{ user.home }}/foo-unarchive.txt"
|
|
|
|
|
|
|
|
mode: preserve
|
|
|
|
|
|
|
|
|
|
|
|
- name: Prep a zip file as unarchivetest1 user
|
|
|
|
- name: Prep a zip file as unarchivetest1 user
|
|
|
|
shell: zip unarchivetest1-unarchive.zip foo-unarchive.txt
|
|
|
|
shell: zip unarchivetest1-unarchive.zip foo-unarchive.txt
|
|
|
@ -36,21 +37,20 @@
|
|
|
|
list_files: True
|
|
|
|
list_files: True
|
|
|
|
register: unarchive10
|
|
|
|
register: unarchive10
|
|
|
|
|
|
|
|
|
|
|
|
- name: verify that the file was marked as changed
|
|
|
|
- name: stat the unarchived file
|
|
|
|
|
|
|
|
stat:
|
|
|
|
|
|
|
|
path: "{{ user.home }}/unarchivetest1-unarchive-zip/foo-unarchive.txt"
|
|
|
|
|
|
|
|
register: archive_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: verify that the tasks performed as expected
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "unarchive10.changed == true"
|
|
|
|
- unarchive10 is changed
|
|
|
|
# Verify that file list is generated
|
|
|
|
# Verify that file list is generated
|
|
|
|
- "'files' in unarchive10"
|
|
|
|
- "'files' in unarchive10"
|
|
|
|
- "{{unarchive10['files']| length}} == 1"
|
|
|
|
- "{{unarchive10['files']| length}} == 1"
|
|
|
|
- "'foo-unarchive.txt' in unarchive10['files']"
|
|
|
|
- "'foo-unarchive.txt' in unarchive10['files']"
|
|
|
|
|
|
|
|
- archive_path.stat.exists
|
|
|
|
- name: verify that the file was unarchived
|
|
|
|
|
|
|
|
file:
|
|
|
|
|
|
|
|
path: "{{ user.home }}/unarchivetest1-unarchive-zip/{{ item }}"
|
|
|
|
|
|
|
|
state: file
|
|
|
|
|
|
|
|
loop:
|
|
|
|
|
|
|
|
- foo-unarchive.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: repeat the last request to verify no changes
|
|
|
|
- name: repeat the last request to verify no changes
|
|
|
|
unarchive:
|
|
|
|
unarchive:
|
|
|
@ -60,10 +60,15 @@
|
|
|
|
list_files: True
|
|
|
|
list_files: True
|
|
|
|
register: unarchive10b
|
|
|
|
register: unarchive10b
|
|
|
|
|
|
|
|
|
|
|
|
- name: verify that the task was not marked as changed
|
|
|
|
# Due to a bug in the date calculation used to determine if a change
|
|
|
|
|
|
|
|
# was made or not, this check is unreliable. This seems to only happen on
|
|
|
|
|
|
|
|
# Ubuntu 1604.
|
|
|
|
|
|
|
|
# https://github.com/ansible/ansible/blob/58145dff9ca1a713f8ed295a0076779a91c41cba/lib/ansible/modules/unarchive.py#L472-L474
|
|
|
|
|
|
|
|
- name: Check that unarchiving again reports no change
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
that:
|
|
|
|
- "unarchive10b.changed == false"
|
|
|
|
- unarchive10b is not changed
|
|
|
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
|
|
always:
|
|
|
|
always:
|
|
|
|
- name: remove our unarchivetest1 user and files
|
|
|
|
- name: remove our unarchivetest1 user and files
|
|
|
|