Skip to content

Commit

Permalink
Add parameters to control management of target directory and unzip pa…
Browse files Browse the repository at this point in the history
…ckage

Add groovy.csh file for environment defaults
  • Loading branch information
esalberg committed Aug 2, 2018
1 parent 48155d0 commit 68848dc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
28 changes: 20 additions & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
# Spencer Herzberg <[email protected]>
#
class groovy (
$version = $groovy::params::version,
$base_url = $groovy::params::base_url,
$target = $groovy::params::target,
$timeout = $groovy::params::timeout,
$version = $groovy::params::version,
$base_url = $groovy::params::base_url,
$target = $groovy::params::target,
$manage_target = $groovy::params::manage_target,
$manage_unzip = $groovy::params::manage_unzip,
$timeout = $groovy::params::timeout,
) inherits groovy::params {

include stdlib
Expand All @@ -31,17 +33,27 @@
content => template("${module_name}/groovy.sh.erb"),
}

file { '/etc/profile.d/groovy.csh':
ensure => file,
mode => '0644',
content => template("${module_name}/groovy.csh.erb"),
}

staging::file { $groovy_filename:
source => "${base_url}/${groovy_filename}",
timeout => $timeout,
}

package { 'unzip':
ensure => present,
if $manage_unzip {
package { 'unzip':
ensure => present,
}
}

file { $target:
ensure => directory,
if $manage_target {
file { $target:
ensure => directory,
}
}

staging::extract { $groovy_filename:
Expand Down
10 changes: 6 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#
# default parameters for the groovy class
class groovy::params {
$version = '2.3.1'
$base_url = 'http://dl.bintray.com/groovy/maven/'
$target = '/opt'
$timeout = 360
$version = '2.3.1'
$base_url = 'http://dl.bintray.com/groovy/maven/'
$target = '/opt'
$manage_target = true
$manage_unzip = true
$timeout = 360
}
2 changes: 2 additions & 0 deletions templates/groovy.csh.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
setenv GROOVY_HOME <%= @groovy_dir %>
setenv PATH "$PATH:<%= @groovy_dir %>/bin"

0 comments on commit 68848dc

Please sign in to comment.