Defined Type: yum::config

Defined in:
manifests/config.pp

Summary

This definition manages yum.conf

Overview

Examples:

configure installonly limit

yum::config { 'installonly_limit':
  ensure => 2,
}

remove a configuration

yum::config { 'debuglevel':
  ensure => absent,
}

Parameters:

  • ensure (Variant[Boolean, Integer, Enum['absent'], String, Sensitive[String]])

    specifies value or absent keyword

  • key (String) (defaults to: $title)

    alternative conf. key (defaults to name)



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
# File 'manifests/config.pp', line 17

define yum::config (
  Variant[Boolean, Integer, Enum['absent'], String, Sensitive[String]] $ensure,
  String                                            $key     = $title,
) {
  include yum::settings
  $_mainconf = $yum::settings::mainconf

  $_ensure = $ensure ? {
    Boolean   => bool2num($ensure),
    Sensitive => $ensure.unwrap,
    default   => $ensure,
  }

  $_changes = $ensure ? {
    'absent'  => "rm  ${key}",
    default   => "set ${key} '${_ensure}'",
  }

  $_show_diff = $ensure ? {
    Sensitive => false,
    default   => true,
  }

  augeas { "${facts['package_provider']}.conf_${key}":
    incl      => $_mainconf,
    lens      => 'Yum.lns',
    context   => "/files${_mainconf}/main/",
    changes   => $_changes,
    show_diff => $_show_diff,
  }
}