Puppet Class: trafficserver

Defined in:
modules/trafficserver/manifests/init.pp

Overview

Class: trafficserver

this class handles common stuff for every trafficserver instance

Parameters

user

Run trafficserver as this user (default: 'trafficserver').

packages

Array of required packages to run trafficserver (default: ['trafficserver', 'trafficserver-experimental-plugins']).

Parameters:

  • user (String) (defaults to: 'trafficserver')
  • packages (Array[String]) (defaults to: ['trafficserver', 'trafficserver-experimental-plugins'])


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 'modules/trafficserver/manifests/init.pp', line 9

class trafficserver(
  String $user = 'trafficserver',
  Array[String] $packages = ['trafficserver', 'trafficserver-experimental-plugins'],
) {
    # ATS is built against libhwloc5 1.11.12 from stretch-backports. Ensure we
    # install that version and not the earlier one from stretch.
    apt::pin { 'libhwloc5':
        pin      => 'release a=stretch-backports',
        package  => 'libhwloc5',
        priority => '1001',
        before   => Package[$packages],
    }

    # Mask trafficserver.service if the package is not installed yet. The
    # unless is deplorable but there is no way in Puppet to execute a command
    # only if a package is being installed but before package installation.
    systemd::mask { 'trafficserver.service':
        unless => '/usr/bin/dpkg -s trafficserver | /bin/grep -q "^Status: install ok installed$"',
    }

    ## Packages
    package { $packages:
        ensure  => present,
        require => [ Exec['apt-get update'], Systemd::Mask['trafficserver.service'] ],
    }

    # Script used to depool, restart and pool an ATS instance
    file { '/usr/local/sbin/ats-restart':
        ensure => present,
        source => 'puppet:///modules/trafficserver/ats_restart.sh',
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
    }
}