Puppet Class: opensearch_dashboards::install::package

Defined in:
manifests/install/package.pp

Summary

Install OpenSearch Dashboards via deb/rpm package.

Overview



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

class opensearch_dashboards::install::package {
  assert_private()

  if $opensearch_dashboards::package_source == 'download' {
    if $opensearch_dashboards::version =~ Undef {
      fail("Using 'opensearch_dashboards::package_source: download' requires to set a version via 'opensearch_dashboards::version: <version>'!")
    }

    $ensure   = $opensearch_dashboards::package_ensure
    $provider = $opensearch_dashboards::package_provider
    $file     = $opensearch_dashboards::package_provider ? {
      'dpkg' => "opensearch-dashboards-${opensearch_dashboards::version}-linux-${opensearch_dashboards::package_architecture}.deb",
      'rpm'  => "opensearch-dashboards-${opensearch_dashboards::version}-linux-${opensearch_dashboards::package_architecture}.rpm",
    }
    $source   = "/tmp/${file}"

    archive { $source:
      provider => 'wget',
      extract  => false,
      cleanup  => true,
      source   => "https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/${opensearch_dashboards::version}/${file}",
    }

    Archive[$source] -> Package['opensearch-dashboards']
  } else {
    $ensure   = pick($opensearch_dashboards::version, $opensearch_dashboards::package_ensure)
    $provider = undef
    $source   = undef

    if $opensearch_dashboards::manage_repository {
      contain opensearch_dashboards::repository
    }

    if $opensearch_dashboards::version !~ Undef and $opensearch_dashboards::pin_package {
      case $facts['os']['family'] {
        'Debian': {
          include apt

          apt::pin { 'opensearch-dashboards':
            version  => $opensearch_dashboards::version,
            packages => 'opensearch-dashboards',
            priority => $opensearch_dashboards::apt_pin_priority,
          }
        }
        'RedHat': {
          include yum

          yum::versionlock { 'opensearch-dashboards':
            version => $opensearch_dashboards::version,
          }
        }
        default: {
          fail('Package pinning is not available for your OS!')
        }
      }
    }
  }

  package { 'opensearch-dashboards':
    ensure   => $ensure,
    provider => $provider,
    source   => $source,
  }
}