mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-12-23 17:10:19 +01:00
Test alternative configuration file creation
This commit is contained in:
parent
faef930c9a
commit
e5ad657038
2 changed files with 38 additions and 0 deletions
|
@ -40,3 +40,10 @@ script:
|
||||||
ANSIBLE_FORCE_COLOR=1 ansible-playbook -i tests/inventory tests/test_set_uncommon.yml --connection=local --become -v
|
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: pass' && exit 0)
|
||||||
|| (echo 'Uncommon configuration test: fail' && exit 1)
|
|| (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)
|
||||||
|
|
31
tests/test_alternative_file.yml
Normal file
31
tests/test_alternative_file.yml
Normal file
|
@ -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
|
Loading…
Reference in a new issue