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.



13
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
# File 'manifests/plugin/versionlock.pp', line 13

class yum::plugin::versionlock (
  String                    $path,
  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',
    }
  }
}