ansible/test/integration/targets/fetch/setup_unreadable_test.yml
Sam Doran be0cdc0ea2
deprecate _remote_checksum() and remove use in fetch (#74848)
* Remove use of _remote_checksum from fetch module
* Add deprecation message displayed during runtime
* Increase test coverage for fetch
* Add tests covering the use of stat from the fetch module

    This required creating an unpriveleged user account and connecting as that user remotely since
    it is not possible to create a file that the root user cannot stat.

* Use fact caching to persist remote tmp dir across playbook runs
* Add variables to setup_remote_tmp test role to allow caching of the remote temp dir fact
  and preventing removal of the remote_tmp_dir
2021-06-16 13:51:07 -04:00

40 lines
1.2 KiB
YAML

- name: Create a user account and configure ssh access
hosts: testhost
gather_facts: no
tasks:
- import_role:
name: fetch_tests
tasks_from: setup.yml
vars:
# Keep the remote temp dir and cache the remote_tmp_dir fact. The directory itself
# and the fact that contains the path are needed in a separate ansible-playbook run.
setup_remote_tmp_dir_skip_cleanup: yes
setup_remote_tmp_dir_cache_path: yes
# This prevents ssh access. It is fixed in some container images but not all.
# https://github.com/ansible/distro-test-containers/pull/70
- name: Remove /run/nologin
file:
path: /run/nologin
state: absent
# Setup ssh access for the unprivileged user.
- name: Get home directory for temporary user
command: echo ~fetcher
register: fetcher_home
- name: Create .ssh dir
file:
path: "{{ fetcher_home.stdout }}/.ssh"
state: directory
owner: fetcher
mode: '0700'
- name: Configure authorized_keys
copy:
src: "~root/.ssh/authorized_keys"
dest: "{{ fetcher_home.stdout }}/.ssh/authorized_keys"
owner: fetcher
mode: '0600'