Debian Codegraph @

test/integration/targets/fetch/test_unreadable_with_stat.yml

raw
1 # This playbook needs to be run as a non-root user without become. Under
2 # those circumstances, the fetch module uses stat and not slurp.
3
4 - name: Test unreadable file using stat
5 hosts: testhost
6 gather_facts: no
7
8 tasks:
9 - name: Check connectivity
10 command: whoami
11 register: whoami
12
13 - name: Verify user
14 assert:
15 that:
16 - whoami.stdout == 'fetcher'
17
18 - name: Try to fetch a file inside an inaccessible directory
19 fetch:
20 src: "{{ remote_tmp_dir }}/noaccess/file1"
21 dest: "{{ output_dir }}"
22 register: failed_fetch_no_access
23 ignore_errors: yes
24
25 - name: Try to fetch a file inside an inaccessible directory without fail_on_missing
26 fetch:
27 src: "{{ remote_tmp_dir }}/noaccess/file1"
28 dest: "{{ output_dir }}"
29 fail_on_missing: no
30 register: failed_fetch_no_access_fail_on_missing
31
32 - assert:
33 that:
34 - failed_fetch_no_access is failed
35 - failed_fetch_no_access.msg is search('Permission denied')
36 - failed_fetch_no_access_fail_on_missing.msg is search(', ignored')