mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-14 23:40:19 +01:00
24c1915595
I noticed some test failures in tests that check ownership/permissions of config files. The tests were recently changed to reuse the same VM, so I suspect config files were not being backed up/restored with the correct file attributes. Use `cp -a` to preserve all file attributes. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
27 lines
748 B
YAML
27 lines
748 B
YAML
---
|
|
- name: Setup
|
|
ansible.builtin.include_tasks: setup.yml
|
|
|
|
- name: Create a temporary directory for backup files
|
|
ansible.builtin.tempfile:
|
|
state: directory
|
|
register: __sshd_test_backup
|
|
changed_when: false
|
|
when:
|
|
- sshd_test_backup_skip is not defined
|
|
|
|
- name: Backup files
|
|
ansible.builtin.shell: |
|
|
if set -o | grep pipefail 2>&1 /dev/null ; then
|
|
set -o pipefail
|
|
fi
|
|
set -eu
|
|
if test -f {{ item }}; then
|
|
mkdir -p {{ __sshd_test_backup.path }}/$(dirname {{ item }})
|
|
cp -a {{ item }} {{ __sshd_test_backup.path }}/$(dirname {{ item }})
|
|
fi
|
|
changed_when: false
|
|
loop: "{{ __sshd_test_backup_files | d([]) }}"
|
|
when:
|
|
- __sshd_test_backup is defined
|
|
- __sshd_test_backup.path is defined
|