Puppet Class: phantomjs

Defined in:
manifests/init.pp

Summary

Install and configure phantomjs

Overview

Examples:

Install PhantomJS 2.1.1 to /usr/local/bin/phantomjs

include ::phantomjs

Install specific version of PhantomJS

class { 'phantomjs':
   version => '1.9.8',
 }

Parameters:

  • version (String) (defaults to: '2.1.1')

    Version of PhantomJS to install.

  • source_url (Optional[String]) (defaults to: undef)

    Optional URL for PhantomJS download.

  • path (Stdlib::Absolutepath) (defaults to: '/usr/local/bin/phantomjs')

    The path to phantomjs binary.

  • package_dependencies (Array) (defaults to: ['bzip2','fontconfig'])

    Array of package dependencies



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'manifests/init.pp', line 20

class phantomjs (
  String $version = '2.1.1',
  Optional[String] $source_url = undef,
  Stdlib::Absolutepath $path = '/usr/local/bin/phantomjs',
  Array $package_dependencies = ['bzip2','fontconfig'],
) {

  $package_dependencies_defaults = {
    'before' => Archive['/tmp/phantomjs.tar.bz2']
  }
  ensure_packages($package_dependencies, $package_dependencies_defaults)

  $source = pick($source_url, "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${version}-linux-x86_64.tar.bz2")

  archive { '/tmp/phantomjs.tar.bz2':
    source       => $source,
    extract      => true,
    extract_path => '/usr/local/src',
    creates      => "/usr/local/src/phantomjs-${version}-linux-x86_64",
    cleanup      => true,
    user         => 'root',
    group        => 'root',
  }
  -> file { 'phantomjs':
    ensure => 'file',
    path   => $path,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
    source => "/usr/local/src/phantomjs-${version}-linux-x86_64/bin/phantomjs"
  }

}