Puppet Class: systemd::purge_units

Defined in:
manifests/purge_units.pp

Summary

Purges previously managed `systemd::manage_unit` units

Overview

Unit files inside ‘$paths` whose first line is the `# Deployed with puppet` header will be removed if they aren’t currently being managed by puppet.

Parameters:

  • daemon_reload (Boolean) (defaults to: true)

    Whether to reload the systemd daemon after purging units

  • paths (Array[Stdlib::Absolutepath, 1]) (defaults to: ['/etc/systemd/system'])

    The path(s) to your systemd units.

  • unit_types (Array[Enum['automount', 'mount', 'path', 'service', 'slice', 'socket', 'swap', 'timer'], 1]) (defaults to: [ 'automount', 'mount', 'path', 'service', 'slice', 'socket', 'swap', 'timer', ])

    The unit file types to purge. Defaults to every type that ‘systemd::manage_unit` can create. Restrict this if you only want certain unit types purged.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'manifests/purge_units.pp', line 13

class systemd::purge_units (
  Boolean                        $daemon_reload = true,
  Array[Stdlib::Absolutepath, 1] $paths         = ['/etc/systemd/system'],
  Array[Enum['automount', 'mount', 'path', 'service', 'slice', 'socket', 'swap', 'timer'], 1] $unit_types = [
    'automount',
    'mount',
    'path',
    'service',
    'slice',
    'socket',
    'swap',
    'timer',
  ],
) {
  systemd_purge_units { $paths:
    unit_types => $unit_types,
  }

  if $daemon_reload {
    systemd::daemon_reload { 'purge_units':
      subscribe => Systemd_purge_units[$paths],
    }
  }
}