Puppet Class: cachefilesd

Defined in:
manifests/init.pp

Summary

Manage cachefilesd

Overview

Manage cachefilesd

Examples:

include cachefilesd

Parameters:

  • manage_repo (Boolean) (defaults to: true)

    Boolean that determines if managing package repo. Only used by Debian 10 at this time

  • manage_package (Boolean) (defaults to: true)

    Boolean that determines if package resource is managed.

  • package_name (String[1]) (defaults to: 'cachefilesd')

    Package name for cachefilesd

  • package_ensure (String[1]) (defaults to: 'installed')

    Package ensure property

  • manage_config (Boolean) (defaults to: true)

    Boolean that determines if config is managed.

  • config_path (Stdlib::Absolutepath) (defaults to: '/etc/cachefilesd.conf')

    Path to cachefilesd.conf

  • manage_dir (Boolean) (defaults to: true)

    Booleans that determines if dir resource is managed.

  • filesecctx (String[1]) (defaults to: 'system_u:object_r:cachefiles_var_t:s0')

    SELinux security context for the dir resource

  • dir (Stdlib::Absolutepath) (defaults to: '/var/cache/fscache')

    cachefilesd dir config option

  • cache_tag (Variant[String[1], Boolean]) (defaults to: 'CacheFiles')

    cachefilesd tag config option

  • brun (Integer[0,99]) (defaults to: 10)

    cachefilesd brun config option

  • bcull (Integer[0,99]) (defaults to: 7)

    cachefilesd bcull config option

  • bstop (Integer[0,99]) (defaults to: 3)

    cachefilesd bstop config option

  • frun (Integer[0,99]) (defaults to: 10)

    cachefilesd frun config option

  • fcull (Integer[0,99]) (defaults to: 7)

    cachefilesd fcull config option

  • fstop (Integer[0,99]) (defaults to: 3)

    cachefilesd fstop config option

  • secctx (String[1]) (defaults to: 'system_u:system_r:cachefiles_kernel_t:s0')

    cachefilesd secctx config option

  • culltable (Integer[12,20]) (defaults to: 12)

    cachefilesd culltable config option

  • nocull (Boolean) (defaults to: false)

    cachefilesd nocull config option

  • resume_thresholds (Optional[String[1]]) (defaults to: undef)

    cachefilesd resume_thresholds config option

  • manage_service (Boolean) (defaults to: true)

    Boolean that determines if cachefilesd service is managed.

  • service_name (String[1]) (defaults to: 'cachefilesd')

    cachefilesd service name

  • service_ensure (String[1]) (defaults to: 'running')

    cachefilesd service ensure property

  • service_enable (Variant[Boolean, Enum['UNSET']]) (defaults to: true)

    cachefilesd service enable property



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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'manifests/init.pp', line 57

class cachefilesd (
  Boolean $manage_repo = true,
  Boolean $manage_package = true,
  String[1] $package_name = 'cachefilesd',
  String[1] $package_ensure = 'installed',
  Boolean $manage_config = true,
  Stdlib::Absolutepath $config_path = '/etc/cachefilesd.conf',
  Boolean $manage_dir = true,
  String[1] $filesecctx = 'system_u:object_r:cachefiles_var_t:s0',
  Stdlib::Absolutepath $dir = '/var/cache/fscache',
  Variant[String[1], Boolean] $cache_tag = 'CacheFiles',
  Integer[0,99] $brun = 10,
  Integer[0,99] $bcull = 7,
  Integer[0,99] $bstop = 3,
  Integer[0,99] $frun = 10,
  Integer[0,99] $fcull = 7,
  Integer[0,99] $fstop = 3,
  String[1] $secctx = 'system_u:system_r:cachefiles_kernel_t:s0',
  Integer[12,20] $culltable = 12,
  Boolean $nocull = false,
  Optional[String[1]] $resume_thresholds = undef,
  Boolean $manage_service = true,
  String[1] $service_name = 'cachefilesd',
  String[1] $service_ensure = 'running',
  Variant[Boolean, Enum['UNSET']] $service_enable = true,
) {
  if ! ($bstop < $bcull and $bcull < $brun ) {
    fail("${module_name}: Requires bstop < bcull < brun")
  }

  if ! ($fstop < $fcull and $fcull < $frun ) {
    fail("${module_name}: Requires fstop < fcull < frun")
  }

  if $service_ensure == 'UNSET' {
    $_service_ensure = undef
  } else {
    $_service_ensure = $service_ensure
  }

  if $service_enable == 'UNSET' {
    $_service_enable = undef
  } else {
    $_service_enable = $service_enable
  }

  if $manage_repo and $facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '10') == 0 {
    include apt::backports
    if $manage_package {
      Class['apt::backports'] -> Package['cachefilesd']
    }
  }

  if $manage_package {
    package { 'cachefilesd':
      ensure => $package_ensure,
      name   => $package_name,
    }
    if $manage_dir {
      Package['cachefilesd'] -> File[$dir]
    }
    if $manage_config {
      Package['cachefilesd'] -> File['cachefilesd.conf']
    }
    if $manage_service {
      Package['cachefilesd'] ~> Service['cachefilesd']
    }
  }

  if $facts['os']['family'] == 'Debian' {
    file_line { 'cachefilesd-RUN':
      ensure => 'present',
      path   => '/etc/default/cachefilesd',
      line   => 'RUN=yes',
      match  => '^RUN=',
      after  => '^#RUN=.*',
    }

    if $manage_package {
      Package['cachefilesd'] -> File_line['cachefilesd-RUN']
    }
    if $manage_service {
      File_line['cachefilesd-RUN'] ~> Service['cachefilesd']
    }
  }

  if $manage_dir {
    $selentries = split($filesecctx, ':')
    $seluser = $selentries[0]
    $selrole = $selentries[1]
    $seltype = $selentries[2]
    $selrange = $selentries[3]

    file { $dir:
      ensure   => 'directory',
      owner    => 'root',
      group    => 'root',
      mode     => '0755',
      seluser  => $seluser,
      selrole  => $selrole,
      seltype  => $seltype,
      selrange => $selrange,
    }
    if $manage_service {
      File[$dir] ~> Service['cachefilesd']
    }
  }

  if $manage_config {
    file { 'cachefilesd.conf':
      ensure  => 'file',
      path    => $config_path,
      owner   => 'root',
      group   => 'root',
      mode    => '0644',
      content => template('cachefilesd/cachefilesd.conf.erb'),
    }
    if $manage_service {
      File['cachefilesd.conf'] ~> Service['cachefilesd']
    }
  }

  if $manage_service {
    service { 'cachefilesd':
      ensure => $_service_ensure,
      enable => $_service_enable,
      name   => $service_name,
    }
  }
}