Debian Codegraph @

test/integration/targets/fetch/setup_unreadable_test.yml

raw
1 - name: Create a user account and configure ssh access
2 hosts: testhost
3 gather_facts: no
4
5 tasks:
6 - import_role:
7 name: fetch_tests
8 tasks_from: setup.yml
9 vars:
10 # Keep the remote temp dir and cache the remote_tmp_dir fact. The directory itself
11 # and the fact that contains the path are needed in a separate ansible-playbook run.
12 setup_remote_tmp_dir_skip_cleanup: yes
13 setup_remote_tmp_dir_cache_path: yes
14 skip_cleanup: yes
15
16 # This prevents ssh access. It is fixed in some container images but not all.
17 # https://github.com/ansible/distro-test-containers/pull/70
18 - name: Remove /run/nologin
19 file:
20 path: /run/nologin
21 state: absent
22
23 # Setup ssh access for the unprivileged user.
24 - name: Get home directory for temporary user
25 command: echo ~fetcher
26 register: fetcher_home
27
28 - name: Create .ssh dir
29 file:
30 path: "{{ fetcher_home.stdout }}/.ssh"
31 state: directory
32 owner: fetcher
33 mode: '0700'
34
35 - name: Configure authorized_keys
36 copy:
37 src: "~root/.ssh/authorized_keys"
38 dest: "{{ fetcher_home.stdout }}/.ssh/authorized_keys"
39 owner: fetcher
40 mode: '0600'