Defined Type: rclone::config

Defined in:
manifests/config.pp

Summary

General configuration for Rclone.

Overview

Ensures Rclone configuration of given name, type and params. Include of ‘rclone` is required.

Examples:

rclone::config { 'my_remote':
  os_user => 'my_user',
  type    => 'ftp',
  options => {...}
}

Parameters:

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    configuration ensure

  • os_user (String)

    operating system user - used to execute rclone commands, effective configuration owner

  • type (Enum[ 'amazon cloud drive', 'azureblob', 'b2', 'box', 'crypt', 'cache', 'chunker', 'drive', 'dropbox', 'fichier', 'ftp', 'google cloud storage', 'google photos', 'http', 'swift', 'hubic', 'jottacloud', 'koofr', 'local', 'mailru', 'mega', 'memory', 'onedrive', 'opendrive', 'pcloud', 'premiumizeme', 'putio', 'qingstor', 's3', 'sftp', 'sharefile', 'sugarsync', 'union', 'webdav', 'yandex'])

    configuration remote type

  • options (Hash[String, Optional[String]])

    configuration options - Hash of options for ‘rclone config` command

  • config_name (String) (defaults to: $title)

    configuration name - should be unique among Rclone configurations, defaults to title



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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'manifests/config.pp', line 22

define rclone::config (
  String $os_user,
  Enum[
    'amazon cloud drive',
    'azureblob',
    'b2',
    'box',
    'crypt',
    'cache',
    'chunker',
    'drive',
    'dropbox',
    'fichier',
    'ftp',
    'google cloud storage',
    'google photos',
    'http',
    'swift',
    'hubic',
    'jottacloud',
    'koofr',
    'local',
    'mailru',
    'mega',
    'memory',
    'onedrive',
    'opendrive',
    'pcloud',
    'premiumizeme',
    'putio',
    'qingstor',
    's3',
    'sftp',
    'sharefile',
    'sugarsync',
    'union',
    'webdav',
    'yandex'] $type,
  Hash[String, Optional[String]] $options,
  Enum['present', 'absent'] $ensure = 'present',
  String $config_name = $title,
) {

  if ! defined(Class[rclone]) {
    fail('You must include the rclone base class before using any defined resources')
  }

  $_operation = $ensure ? {
    'present' => 'create',
    'absent'  => 'delete',
    default   => fail("Invalid ensure value '${ensure}'")
  }

  $_options = $options.filter |$key, $val| { $val != undef }.convert_to(Array).flatten()

  exec { "rclone ${_operation} remote ${config_name} for user ${os_user}":
    command => shell_join(['rclone', 'config', $_operation, $config_name]
      + if ($_operation == 'create') { [$type] + $_options } else { [] }),
    user    => $os_user,
    path    => '/usr/bin',
    require => Class[rclone],
  }
}