Puppet Class: piwik

Defined in:
manifests/init.pp

Overview

Class: piwik

Parameters

path

The path were piwik should be installed to (default: /srv/piwik)

user

The piwik user (default: www-data)

Examples

class { 'piwik':
  path => "/srv/piwik",
  user => "www-data",
}

Authors

Arthur Leonard Andersen <leoc.git@gmail.com>

See LICENSE file, Arthur Leonard Andersen © 2013

Class

piwik

Parameters:

  • url (Any) (defaults to: 'http://builds.piwik.org/latest.zip')
  • path (Any) (defaults to: '/srv/piwik')
  • user (Any) (defaults to: 'www-data')


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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'manifests/init.pp', line 25

class piwik (

  $url  = 'http://builds.piwik.org/latest.zip',
  $path = '/srv/piwik',
  $user = 'www-data',

) {

  if !defined(Package['unzip']) {
    package { 'unzip': }
  }

  file { $path:
    ensure => 'directory',
    owner  => $user,
  }

  exec { 'piwik-download':
    path    => '/bin:/usr/bin',
    creates => "${path}/index.php",
    command => "bash -c 'cd /tmp; wget ${url}'",
    require => File[$path],
    user    => $user,
  }

  exec { 'piwik-unzip':
    path    => '/bin:/usr/bin',
    cwd     => '/tmp',
    creates => "${path}/index.php",
    command => "bash -c 'unzip -o /tmp/latest.zip \'piwik/*\''",
    require => [ Exec['piwik-download'], Package['unzip'] ],
    user    => $user,
  }

  exec { 'piwik-copy':
    path    => '/bin:/usr/bin',
    creates => "${path}/index.php",
    command => "bash -c 'cp -rf /tmp/piwik/* ${path}/'",
    require => Exec['piwik-unzip'],
    user    => $user,
  }

  file { '/tmp/latest.zip':
    ensure  => absent,
    require => Exec['piwik-copy'],
  }

  file { '/tmp/piwik':
    ensure  => absent,
    recurse => true,
    force   => true,
    require => Exec['piwik-copy'],
  }

}