From fcad3473dd09ae8a42b5095001d721da1dd24f1a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 24 Feb 2010 09:51:55 -0500 Subject: add remote_user parameter --- manifests/tunnel.pp | 6 ++++++ templates/autossh-tunnel.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/tunnel.pp b/manifests/tunnel.pp index a90a38a..b4e7bdf 100644 --- a/manifests/tunnel.pp +++ b/manifests/tunnel.pp @@ -6,6 +6,7 @@ define autossh::tunnel ( $host = 'localhost', $hostport, $remote_host, + $remote_user = 'absent', $monitor_port = 'absent', $gatetime = 'absent', $first_poll = 'absent', @@ -17,6 +18,11 @@ define autossh::tunnel ( include autossh + $real_remote_user = $remote_user ? { + 'absent' => $user, + default => $remote_user, + } + # According to the autossh documentation, using OpenSSH ServerAlive # options is better than using a monitor port, so we do that by default. if ($monitor_port == 'absent') { diff --git a/templates/autossh-tunnel.erb b/templates/autossh-tunnel.erb index f19cb51..e89bc2a 100644 --- a/templates/autossh-tunnel.erb +++ b/templates/autossh-tunnel.erb @@ -26,7 +26,7 @@ SCRIPTNAME=/etc/init.d/$NAME # # AutoSSH configuration # -AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= remote_host %>" +AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= real_remote_user %>@<%= remote_host %>" <% if gatetime != 'absent' -%> AUTOSSH_GATETIME=<%= gatetime %> <% end -%> -- cgit v1.2.3