diff options
Diffstat (limited to 'manifests/subsystems/tunnel.pp')
-rw-r--r-- | manifests/subsystems/tunnel.pp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/manifests/subsystems/tunnel.pp b/manifests/subsystems/tunnel.pp index 3756df4..763383b 100644 --- a/manifests/subsystems/tunnel.pp +++ b/manifests/subsystems/tunnel.pp @@ -11,20 +11,20 @@ # this define realizes all needed resources for a hosted tunnel define tunnel_server_realize($host) { - User <<| tag == "backupninja-$host" |>> - File <<| tag == "backupninja-$host" |>> - Ssh_authorized_key <<| tag == "backupninja-$host" |>> + User <<| tag == "backupninja-${host}" |>> + File <<| tag == "backupninja-${host}" |>> + Ssh_authorized_key <<| tag == "backupninja-${host}" |>> } class tunnel { # collect all resources from hosted tunnels - Tunnel_server_realize <<| tag == "$fqdn" |>> + Tunnel_server_realize <<| tag == "${::fqdn}" |>> - define setup($ensure = present, $user = $hostname, $host, $localport, $hostport, $sshport = '22', $keytype = 'rsa') { - $dir = "/var/backups/remote/$user.$domain" - $tag = "backupninja-$fqdn" - $ssh_dir = "$dir/.ssh" + define setup($ensure = present, $user = $hostname, $host, $localport, $hostport, $sshport = '22', $keytype = 'rsa', $root_mail_recipient = hiera('nodo::root_mail_recipient', 'nobody')) { + $dir = "/var/backups/remote/${user}.${::domain}" + $tag = "backupninja-${::fqdn}" + $ssh_dir = "${dir}/.ssh" autossh::tunnel { $name: ensure => $ensure, @@ -37,7 +37,7 @@ class tunnel { sshport => $sshport, } - if !defined(Tunnel_server_realize["${fqdn}@${real_host}"]) { + if !defined(Tunnel_server_realize["${::fqdn}@${real_host}"]) { # this defines just maps that $host host an user environment for $fdqn @@tunnel_server_realize { "${fqdn}@${real_host}": host => $fqdn, @@ -45,24 +45,24 @@ class tunnel { } } - if !defined(File["$dir"]) { - @@file { "$dir": + if !defined(File["${dir}"]) { + @@file { "${dir}": ensure => directory, mode => 0750, owner => $user, group => 0, - tag => "$tag", + tag => "${tag}", } } - if !defined(File["$ssh_dir"]) { - @@file { "$ssh_dir": + if !defined(File["${ssh_dir}"]) { + @@file { "${ssh_dir}": ensure => directory, mode => 0700, owner => $user, group => 0, - require => [User[$user], File["$dir"]], - tag => "$tag", + require => [User[$user], File["${dir}"]], + tag => "${tag}", } } @@ -74,21 +74,21 @@ class tunnel { group => 0, source => "puppet:///modules/site_keys/${user}_id_${keytype}.pub", require => File["${ssh_dir}"], - tag => "$tag", + tag => "${tag}", } } - if !defined(User["$user"]) { - @@user { "$user": + if !defined(User["{$user}"]) { + @@user { "${user}": ensure => "present", - comment => "$user backup sandbox", - home => "$dir", + comment => "${user} backup sandbox", + home => "${dir}", gid => "backupninjas", managehome => true, shell => "/bin/sh", password => '*', require => Group['backupninjas'], - tag => "$tag" + tag => "${tag}" } } } @@ -108,7 +108,7 @@ class tunnel { owner => root, group => root, mode => 0644, - content => "$fqdn\n", + content => "${fqdn}\n", notify => Service["nullmailer"], } @@ -139,8 +139,8 @@ class tunnel { } tunnel::setup { "smtp": - host => "$name.$domain", - sshport => "$sshport", + host => "${name}.${domain}", + sshport => "${sshport}", localport => '2525', hostport => '25', } |