Puppet Class: rsync::server

Defined in:
modules/rsync/manifests/server.pp

Summary

The rsync server. Supports both standard rsync as well as rsync over ssh

Overview

Parameters:

  • address (Variant[ Stdlib::IP::Address, Enum[''] ]) (defaults to: '0.0.0.0')

    the address to listen on can pass an empty string to have it listen on ipv4 and ipv6

  • timeout (Integer) (defaults to: 300)

    the timeout in seconds

  • use_chroot (Stdlib::Yes_no) (defaults to: 'yes')

    if yes funr rsync in chroot

  • rsync_opts (Array) (defaults to: [])

    An array of rsync options

  • rsyncd_conf (Hash) (defaults to: {})

    a hash of additional rsync configuration options

  • ensure_service (Stdlib::Ensure::Service) (defaults to: 'running')

    the ensure state of the service

  • log_file (Optional[Stdlib::Unixpath]) (defaults to: undef)

    path to the log file to use



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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'modules/rsync/manifests/server.pp', line 10

class rsync::server(
    Variant[
        Stdlib::IP::Address,
        Enum['']
    ]                          $address           = '0.0.0.0',
    Integer                    $timeout           = 300,
    Stdlib::Yes_no             $use_chroot        = 'yes',
    Array                      $rsync_opts        = [],
    Hash                       $rsyncd_conf       = {},
    Stdlib::Ensure::Service    $ensure_service    = 'running',
    Optional[Stdlib::Unixpath] $log_file          = undef,
) {
    ensure_packages(['rsync'])

    $rsync_conf      = '/etc/rsyncd.conf'
    $rsync_pid       = '/var/run/rsync.pid'

    concat { $rsync_conf:
        ensure => present,
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
    }

    # rsync daemon defaults file
    file { '/etc/default/rsync':
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => template('rsync/rsync.default.erb'),
    }

    # TODO: When we have migrated all rsync usage off of cleartext and to use stunnel,
    # we can ensure => stopped this.  https://phabricator.wikimedia.org/T237424
    service { 'rsync':
        ensure    => $ensure_service,
        enable    => true,
        require   => Package['rsync'],
        subscribe => [Concat[$rsync_conf], File['/etc/default/rsync']],
    }

    # Cleanup the old method of concatenating the config
    file { '/etc/rsync.d':
        ensure  => absent,
        recurse => true,
        purge   => true,
        force   => true,
    }

    concat::fragment { "${rsync_conf}-header":
        target  => $rsync_conf,
        order   => '01',
        content => template('rsync/header.erb'),
    }
}