-
Notifications
You must be signed in to change notification settings - Fork 0
/
war.pp
37 lines (32 loc) · 1.2 KB
/
war.pp
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
define tomcat::war(
$war_source = 'http://master/tomcat',
$tomcat_stage_dir = '/opt/tomcat/active',
$tomcat_target_dir = '/opt/tomcat/active',
$filename
) {
staging::file { "${tomcat_stage_dir}/war/${filename}":
source => "${war_source}/${filename}",
}
exec { "extract_${name}":
command => "unzip ${tomcat_stage_dir}/war/${filename} -d ${tomcat_target_dir}/apps/${filename}",
path => '/bin:/usr/bin',
refresh => "rm -Rf ${tomcat_target_dir}/apps/${filename} && unzip ${tomcat_stage_dir}/war/${filename} -d ${tomcat_target_dir}/apps/${filename}",
require => [File["${tomcat_target_dir}/apps"], Package['unzip']],
subscribe => [
Staging::File["${tomcat_stage_dir}/war/${filename}"],
File[$tomcat_stage_dir],
File["${tomcat_target_dir}/webapps/${name}"],
],
refreshonly => true,
notify => Service['tomcat'],
}
file { "${tomcat_target_dir}/apps/${filename}":
ensure => directory,
}
file { "${tomcat_target_dir}/webapps/${name}":
ensure => symlink,
target => "${tomcat_target_dir}/apps/${filename}",
require => File["${tomcat_target_dir}/apps/${filename}"],
notify => Service['tomcat'],
}
}