This repository was archived by the owner on Nov 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtarball.pp
More file actions
95 lines (88 loc) · 2.68 KB
/
Copy pathtarball.pp
File metadata and controls
95 lines (88 loc) · 2.68 KB
1
2
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class activemq::package::tarball (
$version = '5.8.0',
$home = $activemq::home,
$user = $activemq::user,
$group = $activemq::group,
$system_user = $activemq::system_user,
$manage_user = $activemq::manage_user,
$manage_group = $activemq::manage_group,
) {
# wget from https://github.com/maestrodev/puppet-wget
include wget
if $manage_user {
if ! defined (User[$user]) {
user { $user:
ensure => present,
home => "${home}/${user}",
managehome => false,
system => $system_user,
before => Wget::Fetch['activemq_download'],
}
}
}
if $manage_group {
if ! defined (Group[$group]) {
group { $group:
ensure => present,
system => $system_user,
before => Wget::Fetch['activemq_download'],
}
}
}
if ( $version =~ /^(5.1\d.\d*)/ ) or ( $version == '5.9.1' ) {
$apache_mirror = "${activemq::apache_mirror}/activemq"
}
else {
$apache_mirror = "${activemq::apache_mirror}/activemq/apache-activemq"
}
wget::fetch { 'activemq_download':
source => "${apache_mirror}/${version}/apache-activemq-${version}-bin.tar.gz",
destination => "/usr/local/src/apache-activemq-${version}-bin.tar.gz",
} ->
exec { 'activemq_untar':
command => "tar xf /usr/local/src/apache-activemq-${version}-bin.tar.gz && chown -R ${user}:${group} ${home}/apache-activemq-${version}",
cwd => $home,
creates => "${home}/apache-activemq-${version}",
path => ['/bin'],
before => File["${home}/activemq"],
}
file { "${home}/activemq":
ensure => "${home}/apache-activemq-${version}",
owner => $user,
group => $group,
require => Exec['activemq_untar'],
} ->
file { '/etc/activemq':
ensure => "${home}/activemq/conf",
require => File["${home}/activemq"],
} ->
file { '/var/log/activemq':
ensure => "${home}/activemq/data",
require => File["${home}/activemq"],
} ->
file { "${home}/activemq/bin/linux":
ensure => "${home}/activemq/bin/linux-x86-64",
require => File["${home}/activemq"],
} ->
file { '/var/run/activemq':
ensure => directory,
owner => $user,
group => $group,
mode => '0755',
} ->
file { '/etc/init.d/activemq':
owner => root,
group => root,
mode => '0755',
content => template('activemq/activemq-init.d.erb'),
}
file { 'wrapper.conf':
path => $activemq::wrapper,
owner => $user,
group => $group,
mode => '0644',
content => template('activemq/wrapper.conf.erb'),
require => [File["${home}/activemq"],File['/etc/init.d/activemq']],
notify => Service['activemq'],
}
}