Puppet Class: ir_agent::install

Defined in:
manifests/install.pp

Summary

Class for installing the Insight agent.

Overview



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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'manifests/install.pp', line 5

class ir_agent::install {
  $source = $ir_agent::source
  $token = $ir_agent::token
  $home = $ir_agent::home
  $auditd_compatibility_mode = $ir_agent::auditd_compatibility_mode
  $https_proxy = $ir_agent::https_proxy
  $agent_installer = $ir_agent::agent_installer

  file { $home:
    ensure => directory,
    owner  => 'root',
    group  => 'root',
    mode   => '0755',
  }

  file { $agent_installer:
    ensure => file,
    source => $source,
    owner  => 'root',
    group  => 'root',
    mode   => '0750',
  }

  if $https_proxy  {
    $_agent_install_cmd = @("CMD"/L)
      ${agent_installer} install_start --token ${token} \
      --https-proxy ${https_proxy}
      |-CMD
  } else {
    $_agent_install_cmd = @("CMD")
      ${agent_installer} install_start --token ${token}
      |-CMD
  }

  exec { 'install_insight_agent':
    command => $_agent_install_cmd,
    creates => "${home}/ir_agent/ir_agent",
    require => File[$agent_installer],
  }

  if $https_proxy {
    file { "${home}/ir_agent/components/bootstrap/common/proxy.config":
      ensure  => file,
      content => "{\"https\": \"${https_proxy}\"}\n",
      owner   => 'root',
      group   => 'root',
      mode    => '0700',
      notify  => Service['ir_agent'],
    }
  } else {
    file { "${home}/ir_agent/components/bootstrap/common/proxy.config":
      ensure => absent,
      notify => Service['ir_agent'],
    }
  }

  service { 'ir_agent':
    ensure  => running,
    enable  => true,
    require => Exec['install_insight_agent'],
  }

}