Puppet Class: opensearch::install::archive

Defined in:
manifests/install/archive.pp

Summary

Install opensearch 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::install::archive {
  assert_private()

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

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

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

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

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

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

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

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

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