diff --git a/.travis.yml b/.travis.yml index 02cb226..43ebef9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,3 +40,10 @@ script: ANSIBLE_FORCE_COLOR=1 ansible-playbook -i tests/inventory tests/test_set_uncommon.yml --connection=local --become -v && (echo 'Uncommon configuration test: pass' && exit 0) || (echo 'Uncommon configuration test: fail' && exit 1) + + # Test 5: Make sure we can modify other files, for example for inclusion + # in the main sshd_config or second sshd service + - > + ANSIBLE_FORCE_COLOR=1 ansible-playbook -i tests/inventory tests/test_alternative_file.yml --connection=local --become -v + && (echo 'Alternative configuration file test: pass' && exit 0) + || (echo 'Alternative configuration file test: fail' && exit 1) diff --git a/tests/test_alternative_file.yml b/tests/test_alternative_file.yml new file mode 100644 index 0000000..ad45868 --- /dev/null +++ b/tests/test_alternative_file.yml @@ -0,0 +1,31 @@ +--- +- hosts: all + become: true + tasks: + - name: Configure alternative sshd_config file + include_role: + name: ansible-sshd + vars: + # just anything -- will not get processed by sshd + sshd_config_file: /etc/ssh/sshd_config_custom + sshd_skip_defaults: true + sshd: + AcceptEnv: LANG + Banner: /etc/issue + Ciphers: aes256-gcm@openssh.com + + - name: Verify the options are correctly set + block: + - meta: flush_handlers + + - name: Print current configuration file + command: cat /etc/ssh/sshd_config_custom + register: config + + - name: Check the options are in configuration file + assert: + that: + - "'AcceptEnv LANG' in config.stdout" + - "'Banner /etc/issue' in config.stdout" + - "'Ciphers aes256-gcm@openssh.com' in config.stdout" + tags: tests::verify