mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-12-23 09:00:19 +01:00
70808e97fc
Use `true/false` instead of `yes/no` Ensure use of FQCN for builtin modules Use correct spacing in Jinja expressions All tasks and plays must have a `name`, and the `name` string must begin with an uppercase letter Use `ansible.posix.mount` instead of `ansible.builtin.mount` Use `set -o pipefail` with `shell` module where supported by the platform shell Signed-off-by: Rich Megginson <rmeggins@redhat.com>
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
---
|
|
- name: Test duplicates - setup config1
|
|
hosts: all
|
|
vars:
|
|
sshd_config_file: /etc/ssh/dup_config1
|
|
__sshd_test_backup_files:
|
|
- /etc/ssh/dup_config1
|
|
- /etc/ssh/dup_config2
|
|
- /etc/ssh/sshd_config
|
|
tasks:
|
|
- name: "Backup configuration files"
|
|
ansible.builtin.include_tasks: tasks/backup.yml
|
|
|
|
- name: Configure config1
|
|
ansible.builtin.include_role:
|
|
name: ansible-sshd
|
|
|
|
- name: Test duplicates - default config
|
|
hosts: all
|
|
tasks:
|
|
- name: Configure default config
|
|
ansible.builtin.include_role:
|
|
name: ansible-sshd
|
|
|
|
- name: Test duplicates - setup config2
|
|
hosts: all
|
|
vars:
|
|
sshd_config_file: /etc/ssh/dup_config2
|
|
tasks:
|
|
- name: Configure config2
|
|
ansible.builtin.include_role:
|
|
name: ansible-sshd
|
|
public: true
|
|
|
|
- name: Convert exported variable to fact so that it is available in next plays
|
|
ansible.builtin.set_fact:
|
|
__sshd_config_file: "{{ __sshd_config_file }}"
|
|
|
|
- name: Test duplicate - verify results
|
|
hosts: all
|
|
tasks:
|
|
- name: Get config1 stat
|
|
ansible.builtin.stat:
|
|
path: /etc/ssh/dup_config1
|
|
register: config1_stat
|
|
|
|
- name: Check config1 exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- config1_stat.stat.exists
|
|
|
|
- name: Get default config stat
|
|
ansible.builtin.stat:
|
|
path: "{{ __sshd_config_file }}"
|
|
register: default_config_stat
|
|
|
|
- name: Check default config exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- default_config_stat.stat.exists
|
|
|
|
- name: Get config2 stat
|
|
ansible.builtin.stat:
|
|
path: "{{ __sshd_config_file }}"
|
|
register: config2_stat
|
|
|
|
- name: Check config2 exists
|
|
ansible.builtin.assert:
|
|
that:
|
|
- config2_stat.stat.exists
|
|
|
|
- name: "Restore configuration files"
|
|
ansible.builtin.include_tasks: tasks/restore.yml
|