Puppet Class: maestro::agent

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

Overview

This class is used to install and configure the Maestro agent.

Parameters

repo

A hash containing the artifact repository URL and credentials.

package_type

Selects the type of package to use for the install. Either rpm, or tarball.

enabled

Enables/disables the service

agent_version

The version to install

facter

Indicates if the agent should use facter

stomp_host

the hostname or IP address of the stomp server

maven_servers

a list of maven servers

agent_name

the name this agent should identify itself with on the Maestro server

maxmemory

the wrapper.java.maxmemory setting to configure in the wrapper.

enable_jpda

A boolean indicating whether or not we want to enable JPDA

support_email

An email address to send any fatal error logs to from the # agent

jmxport

The port number the JMX server will listen on (default 9002)

rmi_server_hostname

The ip address the JMX server will listen on (default $ipaddress)

Parameters:

  • agent_version (Any) (defaults to: 'present')
  • repo (Any) (defaults to: $maestro::params::repo)
  • package_type (Any) (defaults to: $maestro::params::package_type)
  • enabled (Any) (defaults to: true)
  • facter (Any) (defaults to: true)
  • stomp_host (Any) (defaults to: '')
  • maven_servers (Any) (defaults to: '')
  • agent_name (Any) (defaults to: 'maestro_agent')
  • maxmemory (Any) (defaults to: undef)
  • enable_jpda (Any) (defaults to: false)
  • support_email (Any) (defaults to: "support@maestrodev.com")
  • jmxremote (Any) (defaults to: false)
  • jmxport (Any) (defaults to: '9002')
  • rmi_server_hostname (Any) (defaults to: $ipaddress)


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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'manifests/agent.pp', line 20

class maestro::agent(
  $agent_version = 'present',
  $repo = $maestro::params::repo,
  $package_type = $maestro::params::package_type,
  $enabled = true,
  $facter = true,
  $stomp_host = '',
  $maven_servers = '',
  $agent_name = 'maestro_agent',
  $maxmemory = undef,
  $enable_jpda = false,
  $support_email = "support@maestrodev.com",
  $jmxremote = false,
  $jmxport = '9002',
  $rmi_server_hostname = $ipaddress) inherits maestro::params {

  $basedir = '/usr/local/maestro-agent'


  # Note that later pieces assume basedir ends in maestro-agent, would need a
  # different approach

  if ! defined(User[$maestro::params::agent_user]) {

    if ! defined(Group[$maestro::params::agent_group]) {
      group { $maestro::params::agent_group:
        ensure => present,
      }
    }

    if $::operatingsystem == 'Darwin' {
      # User creation is broken in Mountain Lion
      # user { $maestro::params::agent_user:
      #  ensure     => present,
      #  home       => $maestro::params::agent_user_home,
      #  shell      => '/bin/bash',
      #  gid        => $maestro::params::agent_group,
      #  groups     => 'admin',
      #  before     => Class['maestro::agent::package'],
      #}
    } 
    elsif $::operatingsystem == 'windows' {
      user { $maestro::params::agent_user:
        ensure     => present,
        password   => $maestro::params::agent_user_password,
        before     => Class['maestro::agent::package'],
        notify     => Exec['grant-agent-service-permissions'],
      }
      file { 'C:\Windows\Temp\Grant-LogOnAsService.ps1':
        source             => 'puppet:///modules/maestro/agent/Grant-LogOnAsService.ps1',
        source_permissions => ignore,
      } ->
      exec { 'grant-agent-service-permissions':
        command     => "C:\\Windows\\System32\\WindowsPowershell\\v1.0\\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -File C:\\Windows\\Temp\\Grant-LogOnAsService.ps1 ${maestro::params::agent_user}",
        refreshonly => true,
      }
    }
    else
    {
      user { $maestro::params::agent_user:
        ensure     => present,
        managehome => true,
        home       => $maestro::params::agent_user_home,
        shell      => '/bin/bash',
        gid        => $maestro::params::agent_group,
        groups     => 'root',
        system     => true,
        before     => Class['maestro::agent::package'],
      }
    }
  }

  class { 'maestro::agent::package': } -> class { 'maestro::agent::config': } -> class { 'maestro::agent::service': }

}