> On 05/03/2011 08:37 PM, Edd Grant wrote:
> > Hi Martin,
> >
> > Have tried this out and have noticed that the copied .gz
> file is left in /usr/share/java after unpacking.
Is this so bad? I would probably do something like:
$tarball_dir = "/usr/local/src"
$maven_version = "1.2.3"
file { "$tarball_dir/apache-maven-$maven_version.tar.gz":
source => "puppet:///..."
[..]
}
exec { "extract maven archive" :
command => "/usr/bin/tar xzf
$tarball_dir/apache-maven-$maven_version.tar.gz -C /usr/share/java",
require => File["$tarball_dir/apache-maven-$maven_version.tar.gz"]
}
Or somesuch and leave the tarball where it is.
If you want to prune old tarballs you could do something ugly like
exec { "cleanup old maven tarballs":
command => "/bin/find $tarball_dir -name
'apache-maven-*.tar.gz'|/bin/grep -v
apache-maven-$maven_version.tar.gz|/bin/xargs rm -f"
}
or do it the puppet way with a load of file { "foo": ensure => absent }
or have the first file be file { ".../apache-maven.tar.gz": source =>
"puppet:///.../apache-maven-$maven_version.tar.gz" } so that the filename is
invariant, but the contents get replaced with whichever version you pick. This
method has the advantage that you don't get a buildup of old tarballs on the
node.
You could even do
exec { "download and extract mvn" :
command => "/usr/bin/curl
http://foo/apache-maven-$maven_version.tar.gz|/usr/bin/tar xz -C
/usr/share/java",
creates => "[...]",
}
Many ways to crack this egg, and I'm sure people will suggest others.
--
Russell Howe
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.