aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2010-02-24 09:51:55 -0500
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2010-02-24 09:59:57 -0500
commitfcad3473dd09ae8a42b5095001d721da1dd24f1a (patch)
tree565dbe6826b1aaae9b57b9a10992cd59be3f96b7
parent8d9bded5e977016d13e6521ee383cb3d5918506f (diff)
downloadpuppet-autossh-fcad3473dd09ae8a42b5095001d721da1dd24f1a.tar.gz
puppet-autossh-fcad3473dd09ae8a42b5095001d721da1dd24f1a.tar.bz2
add remote_user parameter
-rw-r--r--manifests/tunnel.pp6
-rw-r--r--templates/autossh-tunnel.erb2
2 files changed, 7 insertions, 1 deletions
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 -%>