Puppet Class: mediabackup::storage

Defined in:
modules/mediabackup/manifests/storage.pp

Overview

Media backups storage: Install required packages and configures them.

  • storage_path: the absolute path for the directory that will be

    used for storage of files, as configured by minio
    
  • port: the TCP port number where minio will be listening from

  • root_user: the string containing the admin user name

  • root_password: the string containing the admin authentication

    string.
    
  • config_dir: (deprecated) The location of the main config directory.

    Minio now always stores config in a storage_path subdir.
    

Parameters:

  • storage_path (Stdlib::Unixpath)
  • port (Stdlib::Port)
  • root_user (String)
  • root_password (String)
  • cert_path (Optional[Stdlib::Unixpath])
  • key_path (Optional[Stdlib::Unixpath])
  • ca_path (Optional[Stdlib::Unixpath])
  • config_dir (Stdlib::Unixpath) (defaults to: '/etc/minio')


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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'modules/mediabackup/manifests/storage.pp', line 12

class mediabackup::storage (
    Stdlib::Unixpath $storage_path,
    Stdlib::Port $port,
    String $root_user,
    String $root_password,
    Optional[Stdlib::Unixpath] $cert_path,
    Optional[Stdlib::Unixpath] $key_path,
    Optional[Stdlib::Unixpath] $ca_path,
    Stdlib::Unixpath $config_dir = '/etc/minio',
) {
    ensure_packages(['minio', ])

    group { 'minio-user':
        ensure => present,
        system => true,
    }
    user { 'minio-user':
        ensure     => present,
        gid        => 'minio-user',
        shell      => '/bin/false',
        home       => $storage_path,
        system     => true,
        managehome => false,
        require    => Group['minio-user'],
    }

    file { $storage_path:
        ensure  => directory,
        mode    => '0750',
        owner   => 'minio-user',
        group   => 'minio-user',
        require => [ User['minio-user'], Group['minio-user'] ],
    }
    # Please note that config dir option is deprecated:
    # https://docs.min.io/docs/minio-server-configuration-guide.html
    file { $config_dir:
        ensure  => directory,
        mode    => '0440',
        owner   => 'minio-user',
        group   => 'minio-user',
        require => [ User['minio-user'], Group['minio-user'] ],
    }

    file { "${config_dir}/ssl":
        ensure  => directory,
        mode    => '0700',
        owner   => 'minio-user',
        group   => 'minio-user',
        require => [ File[$config_dir], User['minio-user'], Group['minio-user'] ],
    }

    file { "${storage_path}/.minio":
        ensure  => directory,
        mode    => '0700',
        owner   => 'minio-user',
        group   => 'minio-user',
        require => File[$storage_path],
    }
    file { "${storage_path}/.minio/certs":
        ensure  => directory,
        mode    => '0600',
        owner   => 'minio-user',
        group   => 'minio-user',
        require => File["${storage_path}/.minio"],
    }

    # file names are hardcoded, so using symlinks to expose them
    if $key_path {
        file { "${storage_path}/.minio/certs/private.key":
            ensure => 'link',
            target => $key_path,
            owner  => 'minio-user',
            group  => 'minio-user',
        }
    }
    if $cert_path {
        file { "${storage_path}/.minio/certs/public.crt":
            ensure => 'link',
            target => $cert_path,
            owner  => 'minio-user',
            group  => 'minio-user',
        }
    }

    file { '/etc/default/minio':
        ensure    => present,
        mode      => '0440',
        owner     => 'minio-user',
        group     => 'minio-user',
        content   => template('mediabackup/default_minio.erb'),
        show_diff => false,
        require   => [ User['minio-user'], Group['minio-user'] ],
    }

    service { 'minio':
        ensure  => running,
        enable  => true,
        require => [ Package['minio'], File['/etc/default/minio'] ],
    }
}