aboutsummaryrefslogtreecommitdiff
path: root/manifests/rsync.pp
blob: 733885b38135a7ef6ae81060ac220853b1a8d6d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
define backup::rsync(
    $port           = '22',
    $ensure         = present,
    $bandwidthlimit = false,
    $use_domain     = $::domain,
    $use_fqdn       = $::fqdn
) {
  backupninja::rsync { "rsync-$title.$use_domain":
    # [general]
    ensure         => $ensure,
    keymanage      => false,
    home           => "${backup::params::backupdir}/remote/$use_fqdn",
    backupkeytype  => "rsa",
    id_file        => "/root/.ssh/id_rsa",
    backupkeystore => "puppet:///pubkeys",
    keepdaily      => '4',
    keepweekly     => '2',
    keepmonthly    => '2',
    format         => 'long',
    log            => "/var/log/backup/rsync-$title.$use_domain.log",
    lockfile       => "/var/lock/rsync-$title.$use_domain.lock",
    # [source]
    include        => $backup::params::include_encrypted,
    exclude        => $backup::params::exclude_encrypted,
    # [dest]
    user           => "$hostname",
    host           => "$title.$use_domain",
    port           => $port,
    bandwidthlimit => $bandwidthlimit,
    compress       => '1',
    testconnect    => 'yes',
  }

  if !defined(Nodo::Subsystem::Ssh::Local_key["$hostname"]) {
    nodo::subsystem::ssh::local_key { "$hostname":
      owner => root,
      group => root,
      home  => '/root',
    }
  }
}