]> gitweb.fluxo.info Git - puppet-autossh.git/commitdiff
if 'monitor_port' is defined, don't enable ServerAliveInterval and ServerAliveCountMax
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>
Sat, 26 Dec 2009 19:15:51 +0000 (14:15 -0500)
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>
Sat, 26 Dec 2009 19:15:51 +0000 (14:15 -0500)
manifests/tunnel.pp
templates/autossh-tunnel.erb

index 6d9c9d17363651d24388147da0208fea0de9f978..a90a38accf858a4e1ed006a997b3dd4f7ed0befe 100644 (file)
@@ -6,7 +6,7 @@ define autossh::tunnel (
   $host = 'localhost',
   $hostport,
   $remote_host,
-  $monitor_port = 0,
+  $monitor_port = 'absent',
   $gatetime = 'absent',
   $first_poll = 'absent',
   $poll = 'absent',
@@ -17,6 +17,17 @@ define autossh::tunnel (
 
   include autossh
 
+  # 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') {
+    $real_monitor_port = 0
+    $ssh_extra_options = "-o ServerAliveInterval=30 -o ServerAliveCountMax=3"
+  }
+  else {
+    $real_monitor_port = $monitor_port
+    $ssh_extra_options = ''
+  }
+
   if ($ensure == 'present') {
   
     file { "/etc/init.d/autossh-tunnel-${name}":
index 3302f5a3b93b50c0ea7915e7e5549d868d4b6eca..f19cb514ce8ee708738be4c0adf97bd32b9c6456 100644 (file)
@@ -26,7 +26,7 @@ SCRIPTNAME=/etc/init.d/$NAME
 #
 # AutoSSH configuration
 #
-AUTOSSH_ARGS="-M <%= monitor_port %> -N -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= remote_host %>"
+AUTOSSH_ARGS="-M <%= real_monitor_port %> -N -L <%= bind_address %>:<%= port %>:<%= host %>:<%= hostport %> <%= ssh_extra_options %> <%= remote_host %>"
 <% if gatetime != 'absent' -%>
 AUTOSSH_GATETIME=<%= gatetime %>
 <% end -%>