Puppet Class: maestro::agent::package::tarball

Inherits:
maestro::params
Defined in:
manifests/agent/package/tarball.pp

Overview

Parameters:

  • repo (Any)
  • base_version (Any)
  • timestamp_version (Any)
  • srcdir (Any) (defaults to: $maestro::params::srcdir)
  • basedir (Any)
  • agent_user (Any)
  • agent_group (Any)
  • agent_user_home (Any)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'manifests/agent/package/tarball.pp', line 1

class maestro::agent::package::tarball(
  $repo,
  $base_version,
  $timestamp_version,
  $srcdir = $maestro::params::srcdir,
  $basedir,
  $agent_user,
  $agent_group,
  $agent_user_home) inherits maestro::params {

  include wget

  file { $basedir:
    ensure  => directory,
    owner   => $agent_user,
    group   => $agent_group,
  }

  wget::fetch { 'fetch-agent':
    user        => $repo['username'],
    password    => $repo['password'],
    source      => "${repo['url']}/com/maestrodev/lucee/agent/${base_version}/agent-${timestamp_version}-bin.tar.gz",
    destination => "${srcdir}/agent-${timestamp_version}-bin.tar.gz",
    require     => File[$srcdir],
  } ->
  exec {"rm -rf ${basedir}":
    unless => "egrep \"^${timestamp_version}$\" ${srcdir}/maestro-agent.version",
  } ->
  exec { 'unpack-agent':
    command => "tar zxf ${srcdir}/agent-${timestamp_version}-bin.tar.gz && chown -R ${agent_user}:${agent_group} maestro-agent ${agent_user_home}",
    creates => "${basedir}/lib",
    cwd     => '/usr/local', # TODO use $basedir instead of hardcoded
    notify  => Service['maestro-agent'],
  } ->
  file { "${basedir}/logs":
    ensure  => link,
    target  => "${agent_user_home}/logs",
    owner   => $agent_user,
    group   => $agent_group,
    force   => true,
  }

}