mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-09 21:23:29 +01:00
FIX: indentation including tests
This commit is contained in:
parent
c6b89726ea
commit
961f10b710
3 changed files with 43 additions and 1 deletions
|
@ -118,3 +118,4 @@ script:
|
|||
ANSIBLE_FORCE_COLOR=1 ansible-playbook -i tests/inventory tests/tests_config_namespace.yml --connection=local --become -v
|
||||
&& (echo 'Namespace test: pass' && exit 0)
|
||||
|| (echo 'Namespace test: fail' && exit 1)
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
|
||||
- name: Create the complete configuration file
|
||||
template:
|
||||
src: sshd_config_snippet.j2
|
||||
src: sshd_config.j2
|
||||
dest: "{{ sshd_config_file }}"
|
||||
owner: "{{ sshd_config_owner }}"
|
||||
group: "{{ sshd_config_group }}"
|
||||
|
|
41
tests/tests_indent.yml
Normal file
41
tests/tests_indent.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
__sshd_test_backup_files:
|
||||
- /etc/ssh/sshd_config
|
||||
- /etc/ssh/sshd_config.d/00-ansible_system_role.conf
|
||||
tasks:
|
||||
- name: "Backup configuration files"
|
||||
include_tasks: tasks/backup.yml
|
||||
|
||||
- name: Configure sshd with simple config options
|
||||
include_role:
|
||||
name: ansible-sshd
|
||||
vars:
|
||||
sshd:
|
||||
PasswordAuthentication: yes
|
||||
PermitRootLogin: yes
|
||||
Match:
|
||||
Condition: user root
|
||||
AllowAgentForwarding: no
|
||||
|
||||
- name: Verify the options are correctly set
|
||||
block:
|
||||
- meta: flush_handlers
|
||||
|
||||
- name: Print current configuration file
|
||||
slurp:
|
||||
src: "{{ main_sshd_config }}"
|
||||
register: config
|
||||
|
||||
- name: Check the options are correctly indented in configuration file
|
||||
assert:
|
||||
that:
|
||||
- "config.content | b64decode | regex_search('^PasswordAuthentication yes$', multiline=True)"
|
||||
- "config.content | b64decode | regex_search('^PermitRootLogin yes$', multiline=True)"
|
||||
- "config.content | b64decode | regex_search('^Match user root\\n\\s+AllowAgentForwarding no$', multiline=True)"
|
||||
|
||||
tags: tests::verify
|
||||
|
||||
- name: "Restore configuration files"
|
||||
include_tasks: tasks/restore.yml
|
Loading…
Reference in a new issue