mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-29 14:10:18 +01:00
6887864d2c
Cleaning up yamllint errors. - Use .yamllint.yml and .yamllint_defaults.yml instead of .yamllint.yaml. - Fix the invalid indentations. Cleaning up ansible-lint errors. - Add "name" to every task. - Use command rather than shell - Add "changed_when: false". - Use '|' instead of '>' for the shell module. - Fix '/bin/sh: line 3: CRYPTO_POLICY: unbound variable'. - Add "set -eu" and "set -o pipefail" if pipefail is available. Note: "pipefail" is not available in "sh" and "dash". - Add "- '306' # Shells that use pipes should set the pipefail option" to .ansible-lint since ansible-lint does not recognize it if it's set in "if set -o | grep pipefail". RHELPLAN-73804
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
---
|
|
- name: Restore backed up files and remove what was not present
|
|
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 {{ __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
|
|
file:
|
|
path: "{{ __sshd_test_backup.path }}"
|
|
state: absent
|
|
changed_when: false
|
|
when:
|
|
- __sshd_test_backup is defined
|
|
- __sshd_test_backup.path is defined
|
|
|
|
- name: Restart sshd service
|
|
service:
|
|
name: sshd
|
|
state: reloaded
|
|
changed_when: false
|
|
when:
|
|
- __sshd_test_backup is defined
|
|
- ansible_virtualization_type|default(None) != 'docker'
|
|
- ansible_virtualization_type|default(None) != 'podman'
|
|
- ansible_virtualization_type|default(None) != 'VirtualPC' # for Github Actions
|
|
- ansible_connection != 'chroot'
|
|
- ansible_os_family != 'AIX'
|