From b7754678b8ff25ea0fb1cd9a14efe13a7fb37ab8 Mon Sep 17 00:00:00 2001 From: saheba Date: Thu, 6 Jun 2013 16:43:42 +0200 Subject: [PATCH] extended ant installation class --- manifests/init.pp | 23 +++++++++++++---------- manifests/params.pp | 1 + 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index b674aea..007246b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,21 +3,24 @@ # ==Parameters # # [version] The Ant version to install. -class ant($version = $ant::params::version) inherits ant::params { +class ant($version = $ant::params::version, $install_dir = $ant::params::install_dir, $isdefault = true) inherits ant::params { $srcdir = $ant::params::srcdir - wget::fetch { 'ant': + wget::fetch { "ant-${version}": source => "http://archive.apache.org/dist/ant/binaries/apache-ant-${version}-bin.tar.gz", destination => "${srcdir}/apache-ant-${version}-bin.tar.gz" } -> - exec { 'unpack-ant': + exec { "unpack-ant-${version}": command => "tar zxvf ${srcdir}/apache-ant-${version}-bin.tar.gz", - cwd => '/usr/share/', - creates => "/usr/share/apache-ant-${version}", + cwd => "${install_dir}", + creates => "${install_dir}/apache-ant-${version}", path => '/bin/:/usr/bin', - } -> - file { '/usr/bin/ant': - ensure => link, - target => "/usr/share/apache-ant-${version}/bin/ant", } - + + if ($isdefault) { + file { '/usr/bin/ant': + ensure => link, + target => "${install_dir}/apache-ant-${version}/bin/ant", + require => Exec["unpack-ant-${version}"] + } + } } \ No newline at end of file diff --git a/manifests/params.pp b/manifests/params.pp index dfc1569..91defc7 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,4 +3,5 @@ class ant::params { $srcdir = '/usr/local/src' $version = '1.8.2' + $install_dir = '/usr/share/' } \ No newline at end of file