|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
copy:
|
|
|
|
|
src: foo.txt
|
|
|
|
|
dest: "{{ user.home }}/foo-unarchive.txt"
|
|
|
|
|
mode: preserve
|
|
|
|
|
|
|
|
|
|
- name: Prep a zip file as unarchivetest1 user
|
|
|
|
|
shell: zip unarchivetest1-unarchive.zip foo-unarchive.txt
|
|
|
|
@ -36,21 +37,20 @@
|
|
|
|
|
list_files: True
|
|
|
|
|
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:
|
|
|
|
|
that:
|
|
|
|
|
- "unarchive10.changed == true"
|
|
|
|
|
- unarchive10 is changed
|
|
|
|
|
# Verify that file list is generated
|
|
|
|
|
- "'files' in unarchive10"
|
|
|
|
|
- "{{unarchive10['files']| length}} == 1"
|
|
|
|
|
- "'foo-unarchive.txt' in unarchive10['files']"
|
|
|
|
|
|
|
|
|
|
- name: verify that the file was unarchived
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ user.home }}/unarchivetest1-unarchive-zip/{{ item }}"
|
|
|
|
|
state: file
|
|
|
|
|
loop:
|
|
|
|
|
- foo-unarchive.txt
|
|
|
|
|
- archive_path.stat.exists
|
|
|
|
|
|
|
|
|
|
- name: repeat the last request to verify no changes
|
|
|
|
|
unarchive:
|
|
|
|
@ -60,10 +60,15 @@
|
|
|
|
|
list_files: True
|
|
|
|
|
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:
|
|
|
|
|
that:
|
|
|
|
|
- "unarchive10b.changed == false"
|
|
|
|
|
- unarchive10b is not changed
|
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
|
|
always:
|
|
|
|
|
- name: remove our unarchivetest1 user and files
|
|
|
|
|