Puppet Class: yum::plugin::versionlock

Defined in:
manifests/plugin/versionlock.pp

Summary

This class installs versionlock plugin

Overview

Examples:

Sample usage:

class { 'yum::plugin::versionlock':
  ensure      => present,
}

Parameters:

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

    specifies if versionlock should be present or absent

  • clean (Boolean) (defaults to: false) —

    specifies if yum clean all should be called after edits. Defaults false.

  • path (String) —

    filepath for the versionlock.list, default based on your system.

  • confpath (Stdlib::Unixpath) —

    filepath for the versionlock.conf package, default based on your system.



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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'manifests/plugin/versionlock.pp', line 14

class yum::plugin::versionlock (
  String                    $path,
  Stdlib::Unixpath          $confpath,
  Enum['present', 'absent'] $ensure   = 'present',
  Boolean                   $clean    = false,
) {
  $pkg_prefix = $facts['package_provider'] ? {
    'dnf'   => 'python3-dnf-plugin',
    'yum'   => 'yum-plugin',
    default => '',
  }

  yum::plugin { 'versionlock':
    ensure     => $ensure,
    pkg_prefix => $pkg_prefix,
  }

  if $ensure == 'present' {
    include yum::clean
    $_clean_notify = $clean ? {
      true  => Exec['yum_clean_all'],
      false => undef,
    }

    concat { $path:
      mode   => '0644',
      owner  => 'root',
      group  => 'root',
      notify => $_clean_notify,
    }

    concat::fragment { 'versionlock_header':
      target  => $path,
      content => "# File managed by puppet\n",
      order   => '01',
    }

    augeas { 'enable_versionlock_plugin':
      incl    => $confpath,
      lens    => 'Yum.lns',
      context => "/files${confpath}/main/",
      changes => [
        "set enabled '1'",
        "set locklist '${path}'",
      ],
      require => Yum::Plugin['versionlock'],
    }
  }
}