Defined Type: systemd::tmpfile

Defined in:
manifests/tmpfile.pp

Overview

Creates a systemd tmpfile

Parameters:

  • filename (Systemd::Dropin) (defaults to: $name)

    The name of the tmpfile to create

  • ensure (Enum['present', 'absent', 'file']) (defaults to: 'file')

    Whether to drop a file or remove it

  • path (Stdlib::Absolutepath) (defaults to: '/etc/tmpfiles.d')

    The path to the main systemd tmpfiles directory

  • content (Optional[String]) (defaults to: undef)

    The literal content to write to the file

    • Mutually exclusive with “$source“

  • source (Optional[String]) (defaults to: undef)

    A “File“ resource compatible “source“

    • Mutually exclusive with “$limits“

See Also:

  • systemd-tmpfiles(8)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'manifests/tmpfile.pp', line 26

define systemd::tmpfile (
  Enum['present', 'absent', 'file'] $ensure   = 'file',
  Systemd::Dropin                   $filename = $name,
  Stdlib::Absolutepath              $path     = '/etc/tmpfiles.d',
  Optional[String]                  $content  = undef,
  Optional[String]                  $source   = undef,
) {
  include systemd::tmpfiles

  $_tmp_file_ensure = $ensure ? {
    'present' => 'file',
    default   => $ensure,
  }

  file { "${path}/${filename}":
    ensure  => $_tmp_file_ensure,
    content => $content,
    source  => $source,
    owner   => 'root',
    group   => 'root',
    mode    => '0444',
    notify  => Class['systemd::tmpfiles'],
  }
}