Defined Type: yum::repo

Defined in:
manifests/repo.pp

Summary

Manage individual yum repo files in /etc/yum.repos.d This was used

Overview

in favor of the yumrepo type, which cannot manage files in that directory.

Examples:

Using the define.

yum::repo { 'redhat-base':
  gpgcheck => true,
}

Parameters:

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

    Set to “present” or “absent”. When absent, removes the repository configuration file from the node modeled on the behavior of the File type's ensure parameter.

  • repo_file_mode (Stdlib::Filemode) (defaults to: '0400')

    Set the file mode of the repository configuration file.

  • yum_repos_d_path (Stdlib::Absolutepath) (defaults to: '/etc/yum.repos.d')

    Specify the path of the directory for yum repository files.

  • enabled (Optional[Boolean]) (defaults to: true)

    enabled setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • enablegroups (Optional[Boolean]) (defaults to: undef)

    enablegroups setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • gpgcheck (Optional[Boolean]) (defaults to: false)

    gpgcheck setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • keepalive (Optional[Boolean]) (defaults to: undef)

    keepalive setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • repo_gpgcheck (Optional[Boolean]) (defaults to: undef)

    repo_gpgcheck setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • skip_if_unavailable (Optional[Boolean]) (defaults to: undef)

    skip_if_unavailable setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • ssl_check_cert_permissions (Optional[Boolean]) (defaults to: undef)

    ssl_check_cert_permissions setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • sslverify (Optional[Boolean]) (defaults to: undef)

    sslverify setting in the repository file. True enables, false disables this feature. When undef, it will not be present.

  • bandwidth (Optional[Integer]) (defaults to: undef)

    bandwidth setting in the repository file. Takes any integer. When undef, it will not be present.

  • cost (Optional[Integer]) (defaults to: undef)

    cost setting in the repository file. Takes any integer. When undef, it will not be present.

  • mirrorlist_expire (Optional[Integer]) (defaults to: undef)

    mirrorlist_expire setting in the repository file. Takes any integer. When undef, it will not be present.

  • retries (Optional[Integer]) (defaults to: undef)

    retries setting in the repository file. Takes any integer. When undef, it will not be present.

  • timeout (Optional[Integer]) (defaults to: undef)

    timeout settingg in the repository file. Takes any integer. When undef, it will not be present.

  • description (Optional[String]) (defaults to: $name)

    name setting in the repository file. Defaults to the name of the defined type. When undef, it will not be present.

  • password (Optional[String]) (defaults to: undef)

    password setting in the repository file. When undef, it will not be present.

  • proxy_password (Optional[String]) (defaults to: undef)

    proxy_password setting in the repository file. When undef, it will not be present.

  • proxy_username (Optional[String]) (defaults to: undef)

    proxy_username setting in the repository file. When undef, it will not be present.

  • repositoryid (Optional[String]) (defaults to: undef)

    repositoryid setting in the repository file. When undef, it will not be present.

  • username (Optional[String]) (defaults to: undef)

    username setting in the repository file. When undef, it will not be present.

  • baseurl (Array[Variant[Stdlib::Httpurl,Pattern[/^(file|ftp):\/\//]]]) (defaults to: [])

    baseurl setting in the repository file. Accepts HTTP/HTTPS/FTP/FILE URLs. When undef, it will not be present.

  • gpgcakey (Optional[Stdlib::Httpurl]) (defaults to: undef)

    gpgcakey setting in the repository file. Accepts HTTP/HTTPS URLs. When undef, it will not be present.

  • gpgkey (Array[Variant[Stdlib::Httpurl,Pattern[/^(file|ftp):\/\//]]]) (defaults to: [])

    gpgkey setting in the repository file. Accepts HTTP/HTTPS/FTP/FILE URLs. When undef, it will not be present.

  • metalink (Optional[Stdlib::Httpurl]) (defaults to: undef)

    metalink setting in the repository file. Accepts HTTP/HTTPS URLs. When undef, it will not be present.

  • mirrorlist (Optional[Stdlib::Httpurl]) (defaults to: undef)

    mirrorlist setting in the repository file. Accepts HTTP/HTTPS URLs. When undef, it will not be present.

  • proxy (Optional[Variant[Stdlib::Httpurl,Enum['_none_']]]) (defaults to: undef)

    proxy setting in the repository file. Accepts HTTP/HTTPS URLs and 'none'. When undef, it will not be present.

  • failovermethod (Optional[Enum['priority','roundrobin']]) (defaults to: undef)

    failovermethod setting in the repository file. Valid values are: 'priority' or 'roundrobin'. When undef, it will not be present in yum.conf.

  • http_caching (Optional[Enum['all','none','packages']]) (defaults to: undef)

    http_caching setting in the repository file. Valid values are: 'all', 'none', or 'packages'. When undef, it will not be present in yum.conf.

  • throttle (Optional[Variant[Integer,Float,Pattern[/^\d+(.\d+|)(k|M|G)*$/]]]) (defaults to: undef)

    throttle setting in the repository file. Rate in bytes/sec, allows a suffix of k, M, or G to be appended. When undef, it will not be present.

  • metadata_expire (Optional[Variant[Integer,Pattern[/^(\d+(m|h|d)*|never|)$/]]]) (defaults to: undef)

    metadata_expire setting in the repository file. Time in seconds, allows a suffix of m, h, or d to specify minutes, hours, or days. Alternatively you can also specify the word never instead. When undef, it will not be present.

  • sslcacert (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    sslcacert setting in the repository file. When undef, it will not be present.

  • sslclientcert (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    sslclientcert setting in the repository file. When undef, it will not be present.

  • sslclientkey (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    sslclientkey setting in the repository file. When undef, it will not be present.

  • exclude (Array) (defaults to: [])

    exclude setting in the repository file. When empty, it will not be present.

  • includepkgs (Array) (defaults to: [])

    includepkgs setting in the repository file. When empty, it will not be present.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'manifests/repo.pp', line 158

define yum::repo (
  Enum['absent', 'present'] $ensure             = 'present',
  Stdlib::Filemode $repo_file_mode              = '0400',
  Stdlib::Absolutepath $yum_repos_d_path        = '/etc/yum.repos.d',
  # parameters for repo file
  Array $exclude                                = [],
  Array $includepkgs                            = [],
  Optional[Boolean] $enabled                    = true,
  Optional[Boolean] $enablegroups               = undef,
  Optional[Boolean] $gpgcheck                   = false,
  Optional[Boolean] $keepalive                  = undef,
  Optional[Boolean] $repo_gpgcheck              = undef,
  Optional[Boolean] $skip_if_unavailable        = undef,
  Optional[Boolean] $ssl_check_cert_permissions = undef,
  Optional[Boolean] $sslverify                  = undef,
  Optional[Integer] $bandwidth                  = undef,
  Optional[Integer] $cost                       = undef,
  Optional[Integer] $mirrorlist_expire          = undef,
  Optional[Integer] $retries                    = undef,
  Optional[Integer] $timeout                    = undef,
  Optional[String] $description                 = $name,
  Optional[String] $password                    = undef,
  Optional[String] $proxy_password              = undef,
  Optional[String] $proxy_username              = undef,
  Optional[String] $repositoryid                = undef,
  Optional[String] $username                    = undef,
  Optional[Stdlib::Absolutepath] $sslcacert     = undef,
  Optional[Stdlib::Absolutepath] $sslclientcert = undef,
  Optional[Stdlib::Absolutepath] $sslclientkey  = undef,
  Optional[Stdlib::Httpurl] $gpgcakey           = undef,
  Optional[Stdlib::Httpurl] $metalink           = undef,
  Optional[Stdlib::Httpurl] $mirrorlist         = undef,
  Array[Variant[Stdlib::Httpurl,Pattern[/^(file|ftp):\/\//]]] $baseurl          = [],
  Array[Variant[Stdlib::Httpurl,Pattern[/^(file|ftp):\/\//]]] $gpgkey           = [],
  Optional[Enum['priority','roundrobin']] $failovermethod                       = undef,
  Optional[Enum['all','none','packages']] $http_caching                         = undef,
  Optional[Variant[Stdlib::Httpurl,Enum['_none_']]] $proxy                      = undef,
  Optional[Variant[Integer,Float,Pattern[/^\d+(.\d+|)(k|M|G)*$/]]] $throttle    = undef,
  Optional[Variant[Integer,Pattern[/^(\d+(m|h|d)*|never|)$/]]] $metadata_expire = undef,
) {

  $enabled_string = $enabled ? {
    Boolean => bool2str($enabled, '1', '0'),
    default => undef,
  }

  $enablegroups_string = $enablegroups ? {
    Boolean => bool2str($enablegroups, '1', '0'),
    default => undef,
  }

  $gpgcheck_string = $gpgcheck ? {
    Boolean => bool2str($gpgcheck, '1', '0'),
    default => undef,
  }

  $keepalive_string = $keepalive ? {
    Boolean => bool2str($keepalive, '1', '0'),
    default => undef,
  }

  $repo_gpgcheck_string = $repo_gpgcheck ? {
    Boolean => bool2str($repo_gpgcheck, '1', '0'),
    default => undef,
  }

  $skip_if_unavailable_string = $skip_if_unavailable ? {
    Boolean => bool2str($skip_if_unavailable, '1', '0'),
    default => undef,
  }

  $ssl_check_cert_permissions_string = $ssl_check_cert_permissions ? {
    Boolean => bool2str($ssl_check_cert_permissions, '1', '0'),
    default => undef,
  }

  $sslverify_string = $sslverify ? {
    Boolean => bool2str($sslverify, '1', '0'),
    default => undef,
  }

  $file_ensure = $ensure ? {
    'present' => 'file',
    'absent'  => 'absent',
  }

  # repo file
  # ie: /etc/yum.repos.d/customrepo.repo
  file { "${name}.repo":
    ensure  => $file_ensure,
    path    => "${yum_repos_d_path}/${name}.repo",
    owner   => 'root',
    group   => 'root',
    mode    => $repo_file_mode,
    content => template('yum/repo.erb'),
    notify  => Exec['clean_yum_cache'],
  }
}