Defined Type: psick::yum::plugin

Defined in:
manifests/yum/plugin.pp

Overview

Define: psick::yum::plugin

Parameters:

  • package_name (String) (defaults to: '')
  • source (String) (defaults to: '')
  • template (Variant[String,Undef]) (defaults to: '')
  • enable (Boolean) (defaults to: true)


3
4
5
6
7
8
9
10
11
12
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/yum/plugin.pp', line 3

define psick::yum::plugin (
  String $package_name            = '', # lint:ignore:params_empty_string_assignment
  String $source                  = '', # lint:ignore:params_empty_string_assignment
  Variant[String,Undef] $template = '', # lint:ignore:params_empty_string_assignment
  Boolean $enable                 = true
) {
  $ensure = bool2ensure( $enable )

  $yum_plugins_prefix = $facts['os']['release']['major'] ? {
    '5'     => 'yum',
    '6'     => 'yum-plugin',
    default => 'yum-plugin',
  }

  $real_package_name = $package_name ? {
    ''      => "${yum_plugins_prefix}-${name}",
    default => $package_name,
  }

  package { $real_package_name :
    ensure => $ensure,
  }

  if ( $source != '' ) {
    file { "yum_plugin_conf_${name}":
      ensure => $ensure,
      path   => "${yum::plugins_config_dir}/${name}.conf",
      owner  => root,
      group  => root,
      mode   => '0644',
      source => $source,
    }
  }
}