Files
ansible/roles/ssh/templates/ssh_common.j2
2025-10-10 11:07:34 +00:00

26 lines
713 B
Django/Jinja

# {{ ansible_managed }}
{% macro ssh_config(settings, caller='') %}
{% set sections = ('Host', 'Match') %}
{%- for key, value in settings|dictsort if key not in sections %}
{% if value is sequence and value is not string %}
{% for item in value %}
{{ key }} {{ item }}
{% endfor %}
{% else %}
{{ key }} {{ ['no','yes'][value|int] if value in (False,True) else value }}
{% endif %}
{% endfor %}
{%- for section in sections if section in settings %}
{% for item in settings[section] %}
{{ section }} {{ item[section] }}
{% for key, value in item|dictsort if key != section %}
{{ key }} {{ ['no','yes'][value|int] if value in (False,True) else value }}
{% endfor %}
{% endfor %}
{% endfor -%}
{% endmacro %}