Puppet Class: loki::install
- Defined in:
- manifests/install.pp
Summary
A short summary of the purpose of this classOverview
A description of what this class does
6 7 8 9 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 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 |
# File 'manifests/install.pp', line 6
class loki::install {
case $loki::install_method {
'archive': {
$release_file_name = 'loki-linux-amd64'
$release_file_name_logcli = 'logcli-linux-amd64'
$version_dir = "${loki::data_dir}/loki-${loki::version}"
$binary_path = "${version_dir}/${release_file_name}"
$binary_path_logcli = "${version_dir}/${release_file_name_logcli}"
if $loki::manage_user {
user { 'loki':
ensure => present,
home => $loki::data_dir,
name => $loki::user,
}
group { 'loki':
ensure => present,
name => $loki::group,
}
File[$version_dir] {
require => [Group['loki'],User['loki']],
}
}
file { [$loki::data_dir, $version_dir]:
ensure => directory,
group => $loki::group,
owner => $loki::user,
}
-> archive { "${binary_path}.zip":
ensure => present,
source => "https://github.com/grafana/loki/releases/download/${loki::version}/${release_file_name}.zip",
extract => true,
extract_path => $version_dir,
creates => $binary_path,
cleanup => false,
user => $loki::user,
group => $loki::group,
}
-> archive { "${binary_path_logcli}.zip":
ensure => present,
source => "https://github.com/grafana/loki/releases/download/${loki::version}/${release_file_name_logcli}.zip",
extract => true,
extract_path => $version_dir,
creates => $binary_path_logcli,
cleanup => false,
user => $loki::user,
group => $loki::group,
}
file {
$binary_path:
ensure => file,
mode => '0755',
require => Archive["${binary_path}.zip"],
;
"${loki::bin_dir}/loki":
ensure => link,
target => $binary_path,
require => File[$binary_path],
notify => $loki::service_notify,
;
}
file {
$binary_path_logcli:
ensure => file,
mode => '0755',
require => Archive["${binary_path_logcli}.zip"],
;
"${loki::bin_dir}/logcli":
ensure => link,
target => $binary_path_logcli,
require => File[$binary_path_logcli],
notify => $loki::service_notify,
;
}
}
'package': {
package { 'loki':
ensure => $loki::package_version,
name => $loki::package_name,
}
}
default: {
fail("Installation method ${loki::install_method} not supported")
}
}
}
|