Puppet Class: opensearch_dashboards::install::archive

Defined in:
manifests/install/archive.pp

Summary

Install OpenSearch Dashboards via tarball.

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

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

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

  $file = "opensearch-dashboards-${opensearch_dashboards::version}-linux-${opensearch_dashboards::package_architecture}.tar.gz"

  user { 'opensearch-dashboards':
    ensure     => $opensearch_dashboards::package_ensure,
    home       => $opensearch_dashboards::package_directory,
    managehome => false,
    system     => true,
    shell      => '/bin/false',
  }

  if $opensearch_dashboards::package_ensure == 'present' {
    file { $opensearch_dashboards::package_directory:
      ensure => 'directory',
      owner  => 'opensearch-dashboards',
      group  => 'opensearch-dashboards',
    }

    file { '/var/lib/opensearch-dashboards':
      ensure => 'directory',
      owner  => 'opensearch-dashboards',
      group  => 'opensearch-dashboards',
    }

    file { '/var/log/opensearch-dashboards':
      ensure => 'directory',
      owner  => 'opensearch-dashboards',
      group  => 'opensearch-dashboards',
    }

    archive { "/tmp/${file}":
      extract         => true,
      extract_path    => $opensearch_dashboards::package_directory,
      extract_command => "tar xf %s --strip-components 1 -C ${opensearch_dashboards::package_directory}",
      user            => 'opensearch-dashboards',
      group           => 'opensearch-dashboards',
      creates         => "${opensearch_dashboards::package_directory}/bin/opensearch-dashboards",
      cleanup         => true,
      source          => "https://artifacts.opensearch.org/releases/bundle/opensearch-dashboards/${opensearch_dashboards::version}/${file}",
    }
  } else {
    file { $opensearch_dashboards::package_directory:
      ensure  => $opensearch_dashboards::package_ensure,
      recurse => true,
      force   => true,
    }

    file { '/var/lib/opensearch-dashboards':
      ensure  => $opensearch_dashboards::package_ensure,
      recurse => true,
      force   => true,
    }

    file { '/var/log/opensearch-dashboards':
      ensure  => $opensearch_dashboards::package_ensure,
      recurse => true,
      force   => true,
    }
  }
}