Puppet Class: mediabackup::storage
- Defined in:
- modules/mediabackup/manifests/storage.pp
Overview
SPDX-License-Identifier: Apache-2.0 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
-
console_port: the TCP port number where the built-in browser-based
web interface will be listening from. Useful for human friendly debugging (see:
wikitech.wikimedia.org/wiki/Media_storage/Backups#How_to_access_the_web_UI_of_minio )
-
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.
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 |
# File 'modules/mediabackup/manifests/storage.pp', line 18
class mediabackup::storage (
Stdlib::Unixpath $storage_path,
Stdlib::Port $port,
Stdlib::Port $console_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', ])
systemd::sysuser { 'minio-user':
home_dir => $storage_path,
}
file { $storage_path:
ensure => directory,
mode => '0750',
owner => 'minio-user',
group => 'minio-user',
require => User['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'],
}
file { "${config_dir}/ssl":
ensure => directory,
mode => '0700',
owner => 'minio-user',
group => 'minio-user',
require => [ File[$config_dir], User['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'],
}
service { 'minio':
ensure => running,
enable => true,
require => [ Package['minio'], File['/etc/default/minio'] ],
}
}
|