diff --git a/states/ssh/defaults.yaml b/states/ssh/defaults.yaml index eacf1b0..cd0132c 100644 --- a/states/ssh/defaults.yaml +++ b/states/ssh/defaults.yaml @@ -15,7 +15,7 @@ ssh: AllowGroups: admin X11Forwarding: 'yes' ssh_config: - ForwardAgent: 'yes' - ServerAliveInterval: 120 - TCPKeepAlive: 'yes' - AddKeysToAgent: 'yes' + '*': + ServerAliveInterval: 120 + TCPKeepAlive: 'yes' + AddKeysToAgent: 'yes' diff --git a/states/ssh/templates/ssh_config.j2 b/states/ssh/templates/ssh_config.j2 index 8111f0d..8fb4893 100644 --- a/states/ssh/templates/ssh_config.j2 +++ b/states/ssh/templates/ssh_config.j2 @@ -2,6 +2,9 @@ {%- from "ssh/map.jinja" import ssh with context %} -{%- for key, value in ssh.ssh_config.items() %} -{{ key }} {{ value }} +{%- for match, values in ssh.ssh_config.items() %} +Host {{ match }} +{%- for param_key, param_value in values.items() %} + {{ param_key }} {{ param_value }} {%- endfor %} +{% endfor %}