Skip to content

Instantly share code, notes, and snippets.

@perzizzle
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save perzizzle/c25daebfb66dcb16be42 to your computer and use it in GitHub Desktop.

Select an option

Save perzizzle/c25daebfb66dcb16be42 to your computer and use it in GitHub Desktop.
Unzip ansible module test
# Test unzip module
# (c) 2015, Michael Perzel <michaelperzel@gmail.com>
- name: Unzip test file
win_unzip:
src=C:\file.zip
dest=C:\
register: unzip_output
- name: Gather win_stat on parentFolder
win_stat: path=C:\parentFolder
register: parentFolder_stat
- name: Gather win_stat on childFolder
win_stat: path=C:\parentFolder\childFolder
register: childFolder_stat
- name: Gather win_stat on file.txt
win_stat: path=C:\parentFolder\childFolder\file.txt
register: file_stat
- name: Check that unzip succeeded
assert:
that:
- "not unzip_output|failed"
- "unzip_output|changed"
- "unzip_output.success == true"
- name: Check that parentFolder actual equals expected
assert:
that:
- "not parentFolder_stat|failed"
- "parentFolder_stat.stat.exists == true"
- "parentFolder_stat.stat.isdir == true"
- name: Check that childFolder actual equals expected
assert:
that:
- "not childFolder_stat|failed"
- "childFolder_stat.stat.exists == true"
- "childFolder_stat.stat.isdir == true"
- name: Check that file actual equals expected
assert:
that:
- "not file_stat|failed"
- "file_stat.stat.exists == true"
- "file_stat.stat.isdir == false"
- "file_stat.stat.md5 == 'd41d8cd98f00b204e9800998ecf8427e'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment