summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/unarchive/tasks/test_missing_files.yml
blob: 4f57e184869aa6d40fc4c6ca1fe68d23e1be55c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Test that unarchiving is performed if files are missing
# https://github.com/ansible/ansible-modules-core/issues/1064
- name: create our unarchive destination
  file:
    path: '{{remote_tmp_dir}}/test-unarchive-tar-gz'
    state: directory

- name: unarchive a tar that has directories
  unarchive:
    src: "{{ remote_tmp_dir }}/test-unarchive-dir.tar.gz"
    dest: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
    mode: "0700"
    remote_src: yes
  register: unarchive10

- name: Test that unarchive succeeded
  assert:
    that:
      - "unarchive10.changed == true"

- name: Change the mode of the toplevel dir
  file:
    path: "{{ remote_tmp_dir }}/test-unarchive-tar-gz/unarchive-dir"
    mode: "0701"

- name: Remove a file from the extraction point
  file:
    path: "{{ remote_tmp_dir }}/test-unarchive-tar-gz/unarchive-dir/foo-unarchive.txt"
    state: absent

- name: unarchive a tar that has directories
  unarchive:
    src: "{{ remote_tmp_dir }}/test-unarchive-dir.tar.gz"
    dest: "{{ remote_tmp_dir }}/test-unarchive-tar-gz"
    mode: "0700"
    remote_src: yes
  register: unarchive10_1

- name: Test that unarchive succeeded
  assert:
    that:
      - "unarchive10_1.changed == true"

- name: remove our tar.gz unarchive destination
  file:
    path: '{{ remote_tmp_dir }}/test-unarchive-tar-gz'
    state: absent