Last Updated: February 25, 2016
·
986
· benben

install logentries with puppet

This class is basically the manual installation instructions from https://logentries.com/doc/agent/ for ubuntu 12.04 but puppetized.

class logentries {
  $account_key = hiera('logentries')

  Exec {
    path => '/usr/bin:/usr/sbin:/bin:/sbin',
  }

  exec { 'logentries-apt-source':
    command => "echo 'deb http://rep.logentries.com/ precise main' > /etc/apt/sources.list.d/logentries.list",
    creates => '/etc/apt/sources.list.d/logentries.list',
  } ->

  exec { 'logentries-apt-key':
    command => 'apt-key adv --keyserver pgp.mit.edu --recv-keys C43C79AD && apt-get update',
    unless  => 'apt-key list | grep C43C79AD',
  } ->

  package { ['python-setproctitle', 'logentries']:
    ensure => latest,
  } ->

  exec { 'le-register':
    command => "le register --name=${fqdn} --hostname=${fqdn} --yes --account-key=${account_key}",
    creates => '/etc/le/config',
  } ->

  package { 'logentries-daemon':
    ensure => latest,
  } ->

  service { 'logentries':
    ensure     => running,
    enable     => true,
    hasrestart => true,
  }
}