Puppet Class: cloudinsight_agent

Inherits:
cloudinsight_agent::params
Defined in:
manifests/init.pp

Overview

Class: cloudinsight_agent

This class contains the agent installation mechanism for the cloudinsight-agent module

Parameters:

$ci_url:
    The host of the Cloudinsight intake server to send agent data to.
    Defaults to https://dc-cloud.oneapm.com.
$hostname:
    Your hostname to see in Cloudinsight. Defaults with hostname detection.
$license_key:
    Your Cloudinsight LICENSE Key. Please replace with your key value.
$tags
    Optional array of tags.
$puppet_run_reports
    Will send results from your puppet agent runs back to the cloudinsight service.
    Not impletmented yet.
$puppetmaster_user
    Will chown the api key used by the report processor to this user.
$log_level
    Set value of 'log_level' variable. Default is 'info' as in cloudinsight-agent.
    Valid values here are: critical, debug, error, fatal, info, warn and warning.
$log_to_syslog
    Set value of 'log_to_syslog' variable. Default is true -> yes as in cloudinsight-agent.
    Valid values here are: true or false.
$proxy_host
    Set value of 'proxy_host' variable. Default is blank.
$proxy_port
    Set value of 'proxy_port' variable. Default is blank.
$proxy_user
    Set value of 'proxy_user' variable. Default is blank.
$proxy_password
    Set value of 'proxy_password' variable. Default is blank.
$skip_ssl_validation
    If you run the agent behind haproxy, you might want to set this to yes.
$proxy_forbid_method_switch
    To be used with some proxys that return a 302 which make curl switch from POST to GET.

Actions:

Requires:

Sample Usage:

include cloudinsight_agent

OR

class { ‘cloudinsight_agent’:

license_key   => 'your key',
tags      => ['env:production', 'linux'],
puppet_run_reports  => false,
puppetmaster_user   => puppet,

}

Parameters:

  • ci_url (Any) (defaults to: 'https://dc-cloud.oneapm.com')
  • hostname (Any) (defaults to: '')
  • license_key (Any) (defaults to: 'your_license_key')
  • tags (Any) (defaults to: [])
  • puppet_run_reports (Any) (defaults to: false)
  • puppetmaster_user (Any) (defaults to: 'puppet')
  • log_level (Any) (defaults to: 'info')
  • log_to_syslog (Any) (defaults to: true)
  • service_ensure (Any) (defaults to: 'running')
  • service_enable (Any) (defaults to: true)
  • proxy_host (Any) (defaults to: '')
  • proxy_port (Any) (defaults to: '')
  • proxy_user (Any) (defaults to: '')
  • proxy_password (Any) (defaults to: '')
  • skip_ssl_validation (Any) (defaults to: false)
  • proxy_forbid_method_switch (Any) (defaults to: false)


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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'manifests/init.pp', line 56

class cloudinsight_agent(
  $ci_url = 'https://dc-cloud.oneapm.com',
  $hostname = '',
  $license_key = 'your_license_key',
  $tags = [],
  $puppet_run_reports = false,
  $puppetmaster_user = 'puppet',
  $log_level = 'info',
  $log_to_syslog = true,
  $service_ensure = 'running',
  $service_enable = true,
  $proxy_host = '',
  $proxy_port = '',
  $proxy_user = '',
  $proxy_password = '',
  $skip_ssl_validation = false,
  $proxy_forbid_method_switch = false
) inherits cloudinsight_agent::params {

  validate_string($ci_url)
  validate_string($hostname)
  validate_string($license_key)
  validate_array($tags)
  validate_bool($puppet_run_reports)
  validate_string($puppetmaster_user)
  validate_bool($log_to_syslog)
  validate_string($log_level)
  validate_string($proxy_host)
  validate_string($proxy_port)
  validate_string($proxy_user)
  validate_string($proxy_password)
  validate_bool($skip_ssl_validation)
  validate_bool($proxy_forbid_method_switch)

  include cloudinsight_agent::params
  case upcase($log_level) {
    'CRITICAL': { $_loglevel = 'CRITICAL' }
    'DEBUG':    { $_loglevel = 'DEBUG' }
    'ERROR':    { $_loglevel = 'ERROR' }
    'FATAL':    { $_loglevel = 'FATAL' }
    'INFO':     { $_loglevel = 'INFO' }
    'WARN':     { $_loglevel = 'WARN' }
    'WARNING':  { $_loglevel = 'WARNING' }
    default:    { $_loglevel = 'INFO' }
  }

  case $::operatingsystem {
    'Ubuntu','Debian' : { include cloudinsight_agent::ubuntu }
    'RedHat','CentOS','Fedora','Amazon','Scientific' : { include cloudinsight_agent::redhat }
    default: { fail("Class[cloudinsight_agent]: Unsupported operatingsystem: ${::operatingsystem}") }
  }

  file { '/etc/cloudinsight-agent':
    ensure  => present,
    owner   => 'root',
    group   => 'root',
    mode    => '0755',
    require => Package['cloudinsight-agent'],
  }

  # main agent config file
  # content
  $agent_conf_content = template('cloudinsight_agent/cloudinsight-agent.conf.erb')

  file { '/etc/cloudinsight-agent/cloudinsight-agent.conf':
    ensure  => file,
    content => $agent_conf_content,
    owner   => $cloudinsight_agent::params::cloudinsight_user,
    group   => $cloudinsight_agent::params::cloudinsight_group,
    mode    => '0640',
    notify  => Service[$cloudinsight_agent::params::service_name],
    require => File['/etc/cloudinsight-agent'],
  }

  #if $puppet_run_reports {
  #  class { 'cloudinsight_agent::reports':
  #    license_key           => $license_key,
  #    puppetmaster_user => $puppetmaster_user,
  #  }
  #}

}