3
4
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
77
78
79
|
# File 'manifests/install.pp', line 3
class solr::install {
# == variables == #
# The destination full path to the solr tarball.
$tarball = "${solr::solr_downloads}/solr-${solr::version}.tgz"
# install requirements
ensure_packages($solr::required_packages)
if $solr::manage_java {
ensure_packages($solr::java_package)
$required_package_dependencies = Package[$solr::required_packages,$solr::java_package]
}else{
$required_package_dependencies = Package[$solr::required_packages]
}
## create a solr user
user {$solr::solr_user:
ensure => present,
home => $solr::var_dir,
system => true,
managehome => true,
shell => '/bin/bash',
require => $required_package_dependencies,
}
# directory to store downloaded solr versions and install to
file { $solr::solr_downloads:
ensure => directory,
}
if $solr::install_dir_mg{
file { $solr::install_dir:
ensure => directory,
before => Exec['install_solr_service.sh'],
}
}
# download solr
archive{$tarball:
source => "${solr::url}/${solr::version}/solr-${solr::version}.tgz",
username => $solr::url_user,
password => $solr::url_pass,
require => File[$solr::solr_downloads],
}
# extract install script
exec {'extract install script':
command => "/bin/tar -C ${solr::solr_downloads} -xf ${tarball}\
solr-${solr::version}/bin/install_solr_service.sh --strip-components=2",
refreshonly => true,
subscribe => Archive[$tarball],
}
$service_command = "${solr::solr_downloads}/install_solr_service.sh\
\"${tarball}\" -f -i \"${solr::install_dir}\" -d \"${solr::var_dir}\"\
-u ${solr::solr_user} -p ${solr::solr_port} ${solr::install_options}"
# if versioncmp($solr::version,'6.2.1') == 1 {
# $service_command = "${solr::solr_downloads}/install_solr_service.sh\
# \"${tarball}\" -f -i \"${solr::install_dir}\" -d \"${solr::var_dir}\"\
# -u ${solr::solr_user} -p ${solr::solr_port} ${solr::install_options}"
# }else{
# # version 2.2.1 and less do not have a -d parameter.
# $service_command = "${solr::solr_downloads}/install_solr_service.sh\
# \"${tarball}\" -f -i \"${solr::install_dir}\"\
# -u ${solr::solr_user} -p ${solr::solr_port} ${solr::install_options}"
# }
# run install script
exec {'install_solr_service.sh':
command => $service_command,
refreshonly => true,
subscribe => Exec['extract install script'],
require => User[$solr::solr_user]
}
}
|