Skip to content

Instantly share code, notes, and snippets.

@mathie
Created April 14, 2013 15:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathie/5383077 to your computer and use it in GitHub Desktop.
Save mathie/5383077 to your computer and use it in GitHub Desktop.
Puppet class for installing phantomjs. An example of using curl to grab a tarball for installation.
class phantomjs {
include xvfb
$version = '1.8.1'
$basename = "phantomjs-${version}-linux-x86_64"
$tarball = "${basename}.tar.bz2"
$tarball_path = "/opt/${tarball}"
$url = "http://phantomjs.googlecode.com/files/${tarball}"
$destdir = "/opt/${basename}"
package {
'phantomjs':
ensure => absent;
}
exec {
'download-phantomjs-binary':
command => "/usr/bin/curl -L -o ${tarball_path} ${url}",
creates => $tarball_path;
'unpack-phantomjs-binary':
command => "/bin/tar jxf ${tarball_path}",
cwd => '/opt',
creates => $destdir,
require => Exec['download-phantomjs-binary'];
}
file {
'/usr/local/bin/phantomjs':
ensure => link,
target => "${destdir}/bin/phantomjs",
require => Exec['unpack-phantomjs-binary'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment