mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-22 11:00:19 +01:00
d3e3bdce5a
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
---
|
|
- name: Restore backed up files and remove what was not present
|
|
ansible.builtin.shell: |
|
|
set -eu
|
|
if set -o | grep pipefail 2>&1 /dev/null ; then
|
|
set -o pipefail
|
|
fi
|
|
if test -f {{ __sshd_test_backup.path }}/{{ item }}; then
|
|
cp -a {{ __sshd_test_backup.path }}/{{ item }} $(dirname {{ item }})
|
|
elif test -f {{ item }}; then
|
|
rm {{ item }}
|
|
fi
|
|
changed_when: false
|
|
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
|
|
ansible.builtin.file:
|
|
path: "{{ __sshd_test_backup.path }}"
|
|
state: absent
|
|
changed_when: false
|
|
when:
|
|
- __sshd_test_backup is defined
|
|
- __sshd_test_backup.path is defined
|
|
|
|
- name: Include common variables
|
|
ansible.builtin.include_role:
|
|
name: ansible-sshd
|
|
tasks_from: variables.yml
|
|
public: true
|
|
|
|
- name: Restart sshd service
|
|
ansible.builtin.service:
|
|
name: sshd
|
|
state: reloaded
|
|
changed_when: false
|
|
when:
|
|
- __sshd_test_backup is defined
|
|
- ansible_facts['virtualization_type'] | default(None) not in __sshd_skip_virt_env
|
|
- ansible_connection != 'chroot'
|
|
- ansible_facts['os_family'] != 'AIX'
|