Puppet Class: psick::rclocal

Defined in:
manifests/rclocal.pp

Summary

Manages /etc/rc.local file inserting a /etc/rc.local.d/ directory where each script is managaed by Puppet

Overview

Class: psick::rclocal

Examples:

include psick::rclocal

Parameters:

  • config_file (Stdlib::Absolutepath)

    The full name and path of the rc.local file, defaults to /etc/rc.local on most operatingsystems. Must be an absolute path

  • config_dir (Stdlib::Absolutepath)

    The directory where rc.local snippets are stored. Must be an absolute path

  • template (String[1])

    The template to use to generate the rc.local file. Defaults to module template

  • service_name (String[1])

    The name of the systemd service. Only used on systems with service provider systemd

  • scripts (Hash)

    A hash of snippets to be added. The key must be the snippet name, the values must be parameteres of the rclocal::script define.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'manifests/rclocal.pp', line 25

class psick::rclocal (
  Stdlib::Absolutepath $config_file,
  Stdlib::Absolutepath $config_dir,
  String[1]            $template,
  Hash                 $scripts,
  String[1]            $service_name,
) {
  File {
    owner => 'root',
    group => '0',
    mode  => '0755',
  }

  file { '/etc/rc.local':
    ensure  => file,
    path    => $config_file,
    content => epp($template),
  }

  file { '/etc/rc.local.d':
    ensure  => directory,
    path    => $config_dir,
    purge   => true,
    recurse => true,
  }

  ### Create instances for integration with Hiera
  if $scripts != {} {
    $scripts.each |$k, $v| {
      psick::rclocal::script { $k:
        *       => $v,
        require => File['/etc/rc.local.d'],
      }
    }
  }

  psick::systemd::unit_file { $service_name:
    ensure  => 'present',
    content => epp('psick/rclocal/systemd_rc.local.service.epp'),
    enable  => true,
    active  => true,
  }
}