From 4e95093f8e899afdefde11a3529cc272f1ebc44c Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Wed, 7 Feb 2024 22:00:05 +0100 Subject: [PATCH] updated ssh state --- states/ssh/defaults.yaml | 8 ++++---- states/ssh/templates/ssh_config.j2 | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) 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 %}