2020-11-20 23:12:04 +01:00
|
|
|
---
|
|
|
|
- name: Restore backed up files and remove what was not present
|
2021-04-07 20:12:03 +02:00
|
|
|
shell: |
|
|
|
|
set -eu
|
|
|
|
if set -o | grep pipefail 2>&1 /dev/null ; then
|
|
|
|
set -o pipefail
|
|
|
|
fi
|
2020-11-20 23:12:04 +01:00
|
|
|
if test -f {{ __sshd_test_backup.path }}/{{ item }}; then
|
|
|
|
cp {{ __sshd_test_backup.path }}/{{ item }} $(dirname {{ item }})
|
|
|
|
elif test -f {{ item }}; then
|
|
|
|
rm {{ item }}
|
|
|
|
fi
|
2021-04-07 20:12:03 +02:00
|
|
|
changed_when: false
|
2020-11-20 23:12:04 +01:00
|
|
|
loop: "{{ __sshd_test_backup_files | d([]) }}"
|
|
|
|
when:
|
|
|
|
- __sshd_test_backup is defined
|
|
|
|
- __sshd_test_backup.path is defined
|
|
|
|
|
|
|
|
- name: Remove temporary directory for backup files
|
|
|
|
file:
|
|
|
|
path: "{{ __sshd_test_backup.path }}"
|
|
|
|
state: absent
|
2021-04-07 20:12:03 +02:00
|
|
|
changed_when: false
|
2020-11-20 23:12:04 +01:00
|
|
|
when:
|
|
|
|
- __sshd_test_backup is defined
|
|
|
|
- __sshd_test_backup.path is defined
|
|
|
|
|
2022-04-12 12:18:24 +02:00
|
|
|
- name: Include common variables
|
2022-04-12 21:07:56 +02:00
|
|
|
include_role:
|
|
|
|
name: ansible-sshd
|
|
|
|
tasks_from: set_common_vars.yml
|
|
|
|
public: true
|
2022-04-12 12:18:24 +02:00
|
|
|
|
2020-11-20 23:12:04 +01:00
|
|
|
- name: Restart sshd service
|
|
|
|
service:
|
|
|
|
name: sshd
|
|
|
|
state: reloaded
|
2021-04-07 20:12:03 +02:00
|
|
|
changed_when: false
|
2020-11-20 23:12:04 +01:00
|
|
|
when:
|
|
|
|
- __sshd_test_backup is defined
|
2022-04-11 19:36:03 +02:00
|
|
|
- ansible_virtualization_type|default(None) not in __sshd_skip_virt_env
|
2020-11-20 23:12:04 +01:00
|
|
|
- ansible_connection != 'chroot'
|
|
|
|
- ansible_os_family != 'AIX'
|