Puppet Class: otelcol::install

Defined in:
manifests/install.pp

Overview

Class: otelcol::install

Conditionally handle repos or package paths and install the necessary otelcol package.



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
# File 'manifests/install.pp', line 6

class otelcol::install {
  assert_private()

  if $otelcol::manage_archive {
    case $facts['os']['family'] {
      'Debian': {
        $archive_source = "${otelcol::archive_location}.deb"
      }
      'RedHat': {
        $archive_source = "${otelcol::archive_location}.rpm"
      }
      default: {
        fail('Only RedHat, CentOS, OracleLinux, Debian, Ubuntu repositories are supported at this time')
      }
    }
    $package_source = "${otelcol::localpath_archive}/${archive_source.split('/')[-1]}"
    file { 'otelcol_package':
      path   => $package_source,
      source => $archive_source,
      notify => Package['otelcol'],
    }
  }
  else {
    $package_source = undef
  }

  package { 'otelcol':
    ensure => $otelcol::package_ensure,
    name   => $otelcol::package_name,
    source => $package_source,
  }
}