Defined Type: rsync::retrieve

Defined in:
manifests/retrieve.pp

Overview

Retrieve a file over the rsync protocol

Parameters:

  • source_path (String)

    The path *on the rsync server* from which to retrieve files

    • This will, most likely, not start with a forward slash

  • target_path (String)

    The path to which to write on the client system

  • rsync_server (Variant[Simplib::Host, Simplib::Host::Port]) (defaults to: simplib::lookup('simp_options::rsync::server'))

    The host to which to connect

  • proto (String) (defaults to: 'rsync')

    The protocol to use

    • This will go before the “://“ in the rsync connection string

    • You probably won’t change this

  • rsync_path (Stdlib::Absolutepath) (defaults to: '/usr/bin/rsync')

    The path to the ‘rsync’ command

  • preserve_perms (Boolean) (defaults to: true)

    Preserve the file permissions from the server

  • preserve_acl (Boolean) (defaults to: true)

    Preserve the file ACLs from the server

  • preserve_xattrs (Boolean) (defaults to: true)

    Preserve the extended attributes from the server

  • preserve_owner (Boolean) (defaults to: true)

    Preserve the file owner from the server

  • preserve_group (Boolean) (defaults to: true)

    Preserve the file group from the server

  • preserve_devices (Boolean) (defaults to: false)

    Preserve device special IDs from the server

  • exclude (Array[String]) (defaults to: ['.svn/','.git/'])

    Paths and globs to exclude from transfers

  • rsync_timeout (Integer[0]) (defaults to: 2)

    The number of seconds to wait for a transfer to begin before timing out

  • logoutput (String) (defaults to: 'on_failure')

    Log the output of the rsync run at the provided trigger

  • delete (Boolean) (defaults to: false)

    Delete local files that do not exist on the remote server

  • bwlimit (Optional[String]) (defaults to: simplib::lookup('rsync::bwlimit', { 'default_value' => undef }))

    The bandwidth limit for the connection

  • copy_links (Boolean) (defaults to: false)

    Preserve symlinks during the transfer

  • size_only (Boolean) (defaults to: false)

    Only compare files by size to determine if they need a transfer

  • no_implied_dirs (Boolean) (defaults to: true)

    Don’t send implied directories with relative pathnames

  • user (Optional[String]) (defaults to: undef)

    The username to use when connecting to the server

  • pass (Optional[String]) (defaults to: undef)

    The password to use when connecting to the server

    • If left blank, and a username is provided, the “simplib::passgen()“ function will be used to look up the password

  • pull (Boolean) (defaults to: true)

    Pull files from the remote server

    • If set to “false“, will push files to the server instead of pulling

    them from the server

  • rnotify (Optional[Catalogentry]) (defaults to: undef)

    Wrap a “notify“ so that this process will send a Puppet notification to a resource after completion

    • Use like the regular Puppet “notify“ meta-parameter

  • rsubscribe (Optional[Catalogentry]) (defaults to: undef)

    Wrap a “subscribe“ so that this process will subscribe to a Puppet resource after completion

    • Use like the regular Puppet “subscribe“ meta-parameter

See Also:

  • rsync(1)

Author:

  • Trevor Vaughan <tvaughan@onyxpoint.com>



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'manifests/retrieve.pp', line 96

define rsync::retrieve (
  String                                      $source_path,
  String                                      $target_path,
  Variant[Simplib::Host, Simplib::Host::Port] $rsync_server     = simplib::lookup('simp_options::rsync::server'),
  String                                      $proto            = 'rsync',
  Stdlib::Absolutepath                        $rsync_path       = '/usr/bin/rsync',
  Boolean                                     $preserve_perms   = true,
  Boolean                                     $preserve_acl     = true,
  Boolean                                     $preserve_xattrs  = true,
  Boolean                                     $preserve_owner   = true,
  Boolean                                     $preserve_group   = true,
  Boolean                                     $preserve_devices = false,
  Array[String]                               $exclude          = ['.svn/','.git/'],
  Integer[0]                                  $rsync_timeout    = 2,
  String                                      $logoutput        = 'on_failure',
  Boolean                                     $delete           = false,
  Optional[String]                            $bwlimit          = simplib::lookup('rsync::bwlimit', { 'default_value' => undef }),
  Boolean                                     $copy_links       = false,
  Boolean                                     $size_only        = false,
  Boolean                                     $no_implied_dirs  = true,
  Optional[String]                            $user             = undef,
  Optional[String]                            $pass             = undef,
  Boolean                                     $pull             = true,
  Optional[Catalogentry]                      $rnotify          = undef,
  Optional[Catalogentry]                      $rsubscribe       = undef
) {
  include '::rsync'

  if $pass {
    $_pass = $pass
  }
  else {
    if $user {
      $_pass = simplib::passgen($user)
    }
    else {
      $_pass = undef
    }
  }

  $_action = $pull ? { false => 'push', default => 'pull' }

  rsync { $name:
    source_path      => $source_path,
    target_path      => $target_path,
    rsync_server     => $rsync_server,
    proto            => $proto,
    rsync_path       => $rsync_path,
    preserve_perms   => $preserve_perms,
    preserve_acl     => $preserve_acl,
    preserve_xattrs  => $preserve_xattrs,
    preserve_owner   => $preserve_owner,
    preserve_group   => $preserve_group,
    preserve_devices => $preserve_devices,
    exclude          => $exclude,
    rsync_timeout    => $rsync_timeout,
    logoutput        => $logoutput,
    delete           => $delete,
    bwlimit          => $bwlimit,
    copy_links       => $copy_links,
    size_only        => $size_only,
    no_implied_dirs  => $no_implied_dirs,
    subscribe        => $rsubscribe,
    notify           => $rnotify,
    user             => $user,
    pass             => $_pass,
    action           => $_action
  }
}