mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-25 12:30:19 +01:00
e83cb52ded
The option was introduced in6bb0d7b456
without documentation and intended use. The recent changef6ae2094fe
propagated this option to the generated service files, which is resulting in unexpected results, when a user decided to set only `sshd_config_file` for the second sshd service causing the service file points to the system-wide configuration file. This is an attempt to fix this by introducing some heuristics to guess if the user wants to set up second drop-in directory (ending with .d) or create a standalone configuration file. Fixes: #280
44 lines
1.4 KiB
Django/Jinja
44 lines
1.4 KiB
Django/Jinja
{% macro render_option(key,value,indent=false) %}
|
|
{% if value is defined %}
|
|
{% if value is sameas true %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} yes
|
|
{% elif value is sameas false %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} no
|
|
{% elif value is string or value is number %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} {{ value | string }}
|
|
{% else %}
|
|
{% for i in value %}
|
|
{% if indent %} {% endif %}
|
|
{{ key }} {{ i | string }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% macro body_option(key,override) %}
|
|
{% set value = undefined %}
|
|
{% if override is defined %}
|
|
{% set value = override %}
|
|
{% elif sshd[key] is defined %}
|
|
{% set value = sshd[key] %}
|
|
{% elif sshd_main_config_file is not none
|
|
and sshd_config_file | dirname == sshd_main_config_file ~ '.d' %}
|
|
{# Do not use the defaults from main file to avoid recursion #}
|
|
{% elif __sshd_defaults[key] is defined and not sshd_skip_defaults %}
|
|
{% if key == 'HostKey' and __sshd_fips_mode %}
|
|
{% set value = __sshd_defaults[key] | difference(__sshd_hostkeys_nofips) %}
|
|
{% else %}
|
|
{% set value = __sshd_defaults[key] %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{{ render_option(key,value) -}}
|
|
{% endmacro %}
|
|
{% macro match_block(match_list) %}
|
|
{% if match_list["Condition"] is defined %}
|
|
{% set match_list = [ match_list ]%}
|
|
{% endif %}
|
|
{% if match_list is iterable %}
|
|
{% for match in match_list %}
|
|
Match {{ match["Condition"] }}
|