a8e4c9be7a
* Fail if an empty string is set as src for copy module Fixes #27363 * Cleanup task formatting on copy tests Use multi-line YAML Add debug statements with verbosity: 1 rather than leave them in there commented out. * Add test for empty string as source * Do more checks in order to add more specific errors messages Add more integration tests for the various failure scenarios. Cleanup some syntax on existing integration test tasks.
53 lines
1.5 KiB
YAML
53 lines
1.5 KiB
YAML
- block:
|
|
|
|
- name: Create a local temporary directory
|
|
shell: mktemp -d "${TMPDIR:-/tmp}/ansible_test.XXXXXXXXX"
|
|
register: tempfile_result
|
|
connection: local
|
|
|
|
- set_fact:
|
|
local_temp_dir: '{{ tempfile_result.stdout }}'
|
|
# output_dir is hardcoded in test/runner/lib/executor.py and created there
|
|
remote_dir: '{{ output_dir }}'
|
|
|
|
- name: Create remote unprivileged remote user
|
|
user:
|
|
name: '{{ remote_unprivileged_user }}'
|
|
register: user
|
|
|
|
- file:
|
|
path: "{{ user.home }}/.ssh"
|
|
owner: '{{ remote_unprivileged_user }}'
|
|
state: directory
|
|
mode: 0700
|
|
|
|
- name: Duplicate authorized_keys
|
|
copy:
|
|
src: $HOME/.ssh/authorized_keys
|
|
dest: '{{ user.home }}/.ssh/authorized_keys'
|
|
owner: '{{ remote_unprivileged_user }}'
|
|
mode: 0600
|
|
remote_src: yes
|
|
|
|
- file:
|
|
path: "{{ remote_dir }}"
|
|
state: directory
|
|
remote_user: '{{ remote_unprivileged_user }}'
|
|
|
|
# execute tests tasks using an unprivileged user, this is useful to avoid
|
|
# local/remote ambiguity when controller and managed hosts are identical.
|
|
- import_tasks: tests.yml
|
|
remote_user: '{{ remote_unprivileged_user }}'
|
|
|
|
always:
|
|
- name: Cleaning
|
|
file:
|
|
path: '{{ local_temp_dir }}'
|
|
state: absent
|
|
connection: local
|
|
|
|
- name: Remote unprivileged remote user
|
|
user:
|
|
name: '{{ remote_unprivileged_user }}'
|
|
state: absent
|
|
remove: yes
|