2014-02-12 08:57:00 +01:00
|
|
|
---
|
|
|
|
# To run me manually, use: -i "localhost,"
|
|
|
|
- hosts: localhost
|
|
|
|
connection: local
|
|
|
|
gather_facts: no
|
|
|
|
vars:
|
|
|
|
- testdir: /tmp/ansible-unarchive
|
|
|
|
- filesdir: test_unarchive/files
|
|
|
|
tasks:
|
|
|
|
|
|
|
|
- name: "Simple tar unarchive."
|
|
|
|
command: rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- unarchive: src={{filesdir}}/test.tar dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{filesdir}}/test.tar dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was not expected to be changed."
|
|
|
|
when: res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
|
|
|
|
- name: "Simple tar.gz unarchive."
|
|
|
|
command: rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- unarchive: src={{filesdir}}/test.tar.gz dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{filesdir}}/test.tar.gz dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was not expected to be changed."
|
|
|
|
when: res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
|
|
|
|
- name: "Simple zip unarchive."
|
|
|
|
command: rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- unarchive: src={{filesdir}}/test.zip dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{filesdir}}/test.zip dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
|
|
|
|
- name: "Unarchive a local tar file."
|
|
|
|
command : rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- copy: src={{filesdir}}/test.tar dest={{testdir}}
|
|
|
|
- unarchive: src={{testdir}}/test.tar dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{testdir}}/test.tar dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was not expected to be changed."
|
|
|
|
when: res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
|
|
|
|
- name: "Unarchive a local tar.gz file."
|
|
|
|
command : rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- copy: src={{filesdir}}/test.tar.gz dest={{testdir}}
|
|
|
|
- unarchive: src={{testdir}}/test.tar.gz dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{testdir}}/test.tar.gz dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was not expected to be changed."
|
|
|
|
when: res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
|
|
|
|
- name: "Unarchive a local zip file."
|
|
|
|
command : rm -rf {{testdir}}
|
|
|
|
- file: state=directory dest={{testdir}}
|
|
|
|
- copy: src={{filesdir}}/test.zip dest={{testdir}}
|
|
|
|
- unarchive: src={{testdir}}/test.zip dest={{testdir}}
|
|
|
|
register: res
|
|
|
|
- command: test -f {{testdir}}/foo
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|
2014-02-12 08:57:00 +01:00
|
|
|
- unarchive: src={{testdir}}/test.zip dest={{testdir}}
|
|
|
|
register: res
|
2014-02-12 17:01:10 +01:00
|
|
|
- fail: msg="Resource was expected to be changed."
|
|
|
|
when: not res|changed
|