|
|
|
@ -17,7 +17,7 @@
|
|
|
|
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
# Make sure we start fresh
|
|
|
|
|
|
|
|
|
|
# Need unzup for unarchive module, and zip for archive creation.
|
|
|
|
|
# Need unzip for unarchive module, and zip for archive creation.
|
|
|
|
|
- name: Ensure zip and unzip is present to create test archive (yum)
|
|
|
|
|
yum: name=zip,unzip state=latest
|
|
|
|
|
when: ansible_pkg_mgr == 'yum'
|
|
|
|
@ -26,11 +26,11 @@
|
|
|
|
|
# dnf: name=zip state=latest
|
|
|
|
|
# when: ansible_pkg_mgr == 'dnf'
|
|
|
|
|
|
|
|
|
|
- name: Ensure zip & unzup is present to create test archive (apt)
|
|
|
|
|
- name: Ensure zip & unzip is present to create test archive (apt)
|
|
|
|
|
apt: name=zip,unzip state=latest
|
|
|
|
|
when: ansible_pkg_mgr == 'apt'
|
|
|
|
|
|
|
|
|
|
- name: Ensure zip & unzup is present to create test archive (pkg)
|
|
|
|
|
- name: Ensure zip & unzip is present to create test archive (pkg)
|
|
|
|
|
pkgng: name=zip,unzip state=present
|
|
|
|
|
when: ansible_pkg_mgr == 'pkgng'
|
|
|
|
|
|
|
|
|
@ -184,6 +184,26 @@
|
|
|
|
|
that:
|
|
|
|
|
- "unarchive03b.changed == false"
|
|
|
|
|
|
|
|
|
|
- name: "Create {{ output_dir }}/exclude directory"
|
|
|
|
|
file:
|
|
|
|
|
state: directory
|
|
|
|
|
path: "{{ output_dir }}/exclude"
|
|
|
|
|
|
|
|
|
|
- name: Unpack zip file excluding one file.
|
|
|
|
|
unarchive:
|
|
|
|
|
src: "{{ output_dir }}/test-unarchive.zip"
|
|
|
|
|
dest: "{{ output_dir }}/exclude"
|
|
|
|
|
exclude: "foo-unarchive-*.txt"
|
|
|
|
|
|
|
|
|
|
- name: verify that the file was unarchived
|
|
|
|
|
shell: find {{ output_dir }}/exclude chdir={{ output_dir }}
|
|
|
|
|
register: unarchive_dir01
|
|
|
|
|
|
|
|
|
|
- name: verify that zip extraction excluded file
|
|
|
|
|
assert:
|
|
|
|
|
that:
|
|
|
|
|
- "'foo-unarchive-777.txt' not in unarchive_dir01.stdout"
|
|
|
|
|
|
|
|
|
|
- name: remove our zip unarchive destination
|
|
|
|
|
file: path={{output_dir}}/test-unarchive-zip state=absent
|
|
|
|
|
|
|
|
|
@ -251,7 +271,6 @@
|
|
|
|
|
- name: create our unarchive destination
|
|
|
|
|
file: path={{output_dir}}/test-unarchive-tar-gz state=directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: unarchive over existing extraction and set mode to 0644
|
|
|
|
|
unarchive:
|
|
|
|
|
src: "{{ output_dir }}/test-unarchive.tar.gz"
|
|
|
|
@ -293,7 +312,6 @@
|
|
|
|
|
- name: remove our tar.gz unarchive destination
|
|
|
|
|
file: path={{ output_dir }}/test-unarchive-tar-gz state=absent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: create our unarchive destination
|
|
|
|
|
file: path={{output_dir}}/test-unarchive-zip state=directory
|
|
|
|
|
|
|
|
|
@ -358,11 +376,9 @@
|
|
|
|
|
- name: remove our zip unarchive destination
|
|
|
|
|
file: path={{ output_dir }}/test-unarchive-zip state=absent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: create our unarchive destination
|
|
|
|
|
file: path={{output_dir}}/test-unarchive-tar-gz state=directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: create a directory with quotable chars
|
|
|
|
|
file: path="{{ output_dir }}/test-quotes~root" state=directory
|
|
|
|
|
|
|
|
|
@ -503,7 +519,6 @@
|
|
|
|
|
- name: remove our tar.gz unarchive destination
|
|
|
|
|
file: path={{ output_dir }}/test-unarchive-tar-gz state=absent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create a file
|
|
|
|
|
file:
|
|
|
|
|
path: "{{ output_dir }}/test-unarchive-tar-gz"
|
|
|
|
|