forked from linux-system-roles/ssh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests_no_skip_defaults.yml
More file actions
40 lines (37 loc) · 1.31 KB
/
tests_no_skip_defaults.yml
File metadata and controls
40 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: Test we can write global config with default configuration
hosts: all
vars:
__ssh_test_backup_files:
- /etc/ssh/ssh_config.d/00-ansible.conf
- /etc/ssh/ssh_config
__ssh_test_option: >-
{% if ansible_facts['os_family'] in ['Ubuntu', 'Debian'] %}
HashKnownHosts yes
{% elif ansible_facts['os_family'] == 'Suse' or
ansible_facts['distribution'] == 'Fedora' or
(ansible_facts['distribution'] in ['RedHat', 'CentOS'] and
ansible_facts['distribution_version'] | int >= 8) %}
Include /etc/ssh/ssh_config.d/*.conf
{% else %}
GSSAPIAuthentication yes
{% endif %}
tasks:
- name: Backup configuration files
include_tasks: tasks/backup.yml
- name: Run role
include_tasks: tasks/run_role_with_clear_facts.yml
vars:
ssh_skip_defaults: false
ssh_config_file: /tmp/ssh_config_with_defaults
ssh:
LocalForward: 2222 localhost:22
- name: Download the new configuration file
slurp:
src: /tmp/ssh_config_with_defaults
register: config
- name: Check if the selected options are in
assert:
that:
- "__ssh_test_option | trim in config.content | b64decode"
- "'LocalForward 2222 localhost:22' in config.content | b64decode"