Debian Codegraph @

test/integration/targets/unarchive/tasks/test_exclude.yml

raw
1 - name: "Create {{ remote_tmp_dir }}/exclude directory"
2 file:
3 state: directory
4 path: "{{ remote_tmp_dir }}/exclude-{{item}}"
5 with_items:
6 - zip
7 - tar
8
9 - name: Unpack archive file excluding regular and glob files.
10 unarchive:
11 src: "{{ remote_tmp_dir }}/unarchive-00.{{item}}"
12 dest: "{{ remote_tmp_dir }}/exclude-{{item}}"
13 remote_src: yes
14 list_files: yes
15 exclude:
16 - "exclude/exclude-*.txt"
17 - "other/exclude-1.ext"
18 register: result_of_unarchive
19 with_items:
20 - zip
21 - tar
22
23 - name: Make sure unarchive module reported back extracted files
24 assert:
25 that:
26 - "'include/include-1.txt' in item.files"
27 - "'include/include-2.txt' in item.files"
28 - "'include/include-3.txt' in item.files"
29 - "'other/include-1.ext' in item.files"
30 - "'other/include-2.ext' in item.files"
31 - "'other/exclude-2.ext' in item.files"
32 - "'other/other-1.ext' in item.files"
33 - "'other/other-2.ext' in item.files"
34 loop: "{{ result_of_unarchive.results }}"
35
36 - name: verify that the file was unarchived
37 shell: find {{ remote_tmp_dir }}/exclude-{{item}} chdir={{ remote_tmp_dir }}
38 register: unarchive00
39 with_items:
40 - zip
41 - tar
42
43 - name: verify that archive extraction excluded the files
44 assert:
45 that:
46 - "'exclude/exclude-1.txt' not in item.stdout"
47 - "'other/exclude-1.ext' not in item.stdout"
48 with_items:
49 - "{{ unarchive00.results }}"
50
51 - name: remove our zip unarchive destination
52 file:
53 path: '{{remote_tmp_dir}}/test-unarchive-zip'
54 state: absent