diff --git a/templates/sshd_config.erb b/templates/sshd_config.erb index 50e57b789..13db0d1a9 100644 --- a/templates/sshd_config.erb +++ b/templates/sshd_config.erb @@ -1,9 +1,18 @@ # File is managed by Puppet +<%- options = scope.lookupvar('ssh::server::merged_options') -%> +<%- if port = options.delete('Port') -%> +Port <%= port %> +<%- end -%> +<%- if listen = options.delete('ListenAddress') -%> +ListenAddress <%= listen %> +<%- end -%> -<%- scope.lookupvar('ssh::server::merged_options').sort_by{ |sk| (sk.to_s.downcase.include? "match") ? sk.to_s : '' }.each do |k, v| -%> +<%- options.keys.sort_by{ |sk| (sk.to_s.downcase.include? "match") ? 'zzz' + sk.to_s : sk.to_s }.each do |k| -%> +<%- v = options[k] -%> <%- if v.is_a?(Hash) -%> <%= k %> -<%- v.sort.each do |key, value| -%> +<%- v.keys.sort.each do |key| -%> + <%- value = v[key] -%> <%- if value.is_a?(Array) -%> <%- value.each do |a| -%> <%= key %> <%= a %>