Puppet Class: solr::install

Defined in:
manifests/install.pp

Summary

Installs and prepares the Solr application.

Overview



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

class solr::install {
  assert_private()

  include 'archive'

  if $solr::manage_additional_packages {
    ensure_packages($solr::additional_packages)
  }

  file { $solr::staging_dir:
    ensure    => directory,
    recurse   => true,
    # Suppress warning about exceeding the limit for number of files.
    max_files => -1,
  }

  archive { "${solr::staging_dir}/solr-${solr::version}.tgz":
    source       => "${solr::mirror}/${solr::version}/solr-${solr::version}.tgz",
    extract      => true,
    extract_path => $solr::staging_dir,
    creates      => "${solr::staging_dir}/solr-${solr::version}",
    cleanup      => false,
  }

  user { $solr::solr_user:
    ensure     => present,
    managehome => true,
    system     => true,
    before     => Exec['run solr install script'],
  }

  if $solr::upgrade {
    $upgrade_flag = '-f'
  }
  else {
    $upgrade_flag = ''
  }

  $install_command = join([
      "${solr::staging_dir}/solr-${solr::version}/bin/install_solr_service.sh",
      "${solr::staging_dir}/solr-${solr::version}.tgz",
      "-i ${solr::extract_dir}",
      "-d ${solr::var_dir}",
      "-u ${solr::solr_user}",
      "-s ${solr::service_name}",
      "-p ${solr::solr_port}",
      '-n',
      $upgrade_flag,
  ], ' ')

  exec { 'run solr install script':
    command => $install_command,
    cwd     => "${solr::staging_dir}/solr-${solr::version}",
    creates => "${solr::extract_dir}/solr-${solr::version}",
    require => Archive["${solr::staging_dir}/solr-${solr::version}.tgz"],
  }

  file { $solr::var_dir:
    ensure  => directory,
    owner   => $solr::solr_user,
    group   => $solr::solr_user,
    recurse => true,
    require => Exec['run solr install script'],
  }

  file { $solr::log_dir:
    ensure  => directory,
    owner   => $solr::solr_user,
    group   => $solr::solr_user,
    require => Exec['run solr install script'],
  }
}