Puppet Class: varnish::shmlog

Defined in:
manifests/shmlog.pp

Summary

Mounts shmlog as tempfs

Overview

Examples:

Disable config for mounting shmlog as tmpfs

class { 'varnish::shmlog':
  tempfs => false,
}

Parameters:

  • shmlog_dir (Stdlib::Absolutepath) (defaults to: '/var/lib/varnish')

    directory where Varnish logs

  • tempfs (Boolean) (defaults to: true)

    mount or not shmlog as tmpfs, boolean

  • size (String) (defaults to: '170M')

    size definition of shmlog tmpfs



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
# File 'manifests/shmlog.pp', line 14

class varnish::shmlog (
  Stdlib::Absolutepath $shmlog_dir = '/var/lib/varnish',
  Boolean              $tempfs     = true,
  String               $size       = '170M',
) {
  file { 'shmlog-dir':
    ensure  => directory,
    path    => $shmlog_dir,
    seltype => 'varnishd_var_lib_t',
  }

  # mount shared memory log dir as tmpfs
  $shmlog_share_state = $tempfs ? {
    true    => mounted,
    default => absent,
  }

  $options = $facts['os']['selinux']['enabled'] ? {
    true    => "defaults,noatime,size=${size},rootcontext=system_u:object_r:varnishd_var_lib_t:s0",
    default => "defaults,noatime,size=${size}",
  }

  mount { 'shmlog-mount':
    ensure  => $shmlog_share_state,
    name    => $shmlog_dir,
    target  => '/etc/fstab',
    fstype  => 'tmpfs',
    device  => 'tmpfs',
    options => $options,
    pass    => '0',
    dump    => '0',
    require => File['shmlog-dir'],
  }
}