diff --git a/tests/tests_alternative_file.yml b/tests/tests_alternative_file.yml index 172c73a..75a2d35 100644 --- a/tests/tests_alternative_file.yml +++ b/tests/tests_alternative_file.yml @@ -38,6 +38,7 @@ Banner: /etc/issue Ciphers: aes256-ctr sshd_Compression: no + - name: Configure second alternative sshd_config file include_role: name: ansible-sshd @@ -49,6 +50,7 @@ Banner: /etc/issue2 Ciphers: aes128-ctr sshd_MaxStartups: 100 + - name: Now configure the main sshd_config file include_role: name: ansible-sshd @@ -114,6 +116,16 @@ - "'MaxStartups 100' not in config3.content | b64decode" - "'Compression no' not in config3.content | b64decode" + - name: Check the main configuration file contains some default values for RHEL 9 or Fedora + assert: + that: + - "'Include /etc/ssh/sshd_config.d/*.conf' in config3.content | b64decode" + - "'AuthorizedKeysFile .ssh/authorized_keys' in config3.content | b64decode" + - "'Subsystem sftp /usr/libexec/sftp-server' in config3.content | b64decode" + when: + - ansible_facts['os_family'] == 'RedHat' + - ansible_facts['distribution_major_version']|int > 8 + - name: Check the generated config has requested properties assert: that: diff --git a/tests/tests_alternative_file_role.yml b/tests/tests_alternative_file_role.yml index 09fbce4..e46d427 100644 --- a/tests/tests_alternative_file_role.yml +++ b/tests/tests_alternative_file_role.yml @@ -130,6 +130,16 @@ - "'MaxStartups 100' not in config3.content | b64decode" - "'Compression no' not in config3.content | b64decode" + - name: Check the main configuration file contains some default values for RHEL 9 or Fedora + assert: + that: + - "'Include /etc/ssh/sshd_config.d/*.conf' in config3.content | b64decode" + - "'AuthorizedKeysFile .ssh/authorized_keys' in config3.content | b64decode" + - "'Subsystem sftp /usr/libexec/sftp-server' in config3.content | b64decode" + when: + - ansible_facts['os_family'] == 'RedHat' + - ansible_facts['distribution_major_version']|int > 8 + - name: Check the generated config has requested properties assert: that: