Puppet Class: yum::server

Defined in:
manifests/server.pp

Summary

Manage a yum repository service

Overview

Parameters:

  • contact_email (String) (defaults to: 'root@localhost')

    Set email address for server administration contact. Will be used for ServerAdmin in Apache vhost configuration.

  • docroot (Stdlib::Absolutepath) (defaults to: '/opt/repos')

    Set absolute path to document root. Will be used for DocumentRoot Apache vhost configuration.

  • gpg_keys_path (String) (defaults to: 'keys')

    Set relative path to GPG keys directory which will be in $docroot directory. $docroot/$gpg_keys_path will be created and used.

  • gpg_user_name (String) (defaults to: 'Root')

    Set user who signs the packages. Will be used as %_gpg_name in /root/.rpmmacros.

  • servername (String) (defaults to: 'yum')

    Set servername for yum repository. Will be used for ServerName in Apache vhost configuration.

  • serveraliases (Array[String, 1]) (defaults to: [ $::fqdn, $::hostname ])

    Set serveraliases for yum repository. Will be used for ServerAlias Apache vhost configuration.

  • http_listen_ip (Stdlib::IP::Address::Nosubnet) (defaults to: $::ipaddress)

    Set listen IP for yum repository server. Will be used for VirtualHost in Apache vhost configuration.



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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'manifests/server.pp', line 31

class yum::server (
  String $contact_email                         = 'root@localhost',
  Stdlib::Absolutepath $docroot                 = '/opt/repos',
  String $gpg_keys_path                         = 'keys', # gpg_keys_path is relative to $docroot, ${docroot}/${gpg_keys_path}
  String $gpg_user_name                         = 'Root',
  String $servername                            = 'yum',
  Array[String, 1]  $serveraliases              = [ $::fqdn, $::hostname ],
  Stdlib::IP::Address::Nosubnet $http_listen_ip = $::ipaddress,
) {

  include ::apache

  package { 'createrepo':
    ensure => installed,
  }

  package { 'hardlink':
    ensure => installed,
  }

  file { 'gpg_keys_dir':
    ensure  => directory,
    path    => "${docroot}/${gpg_keys_path}",
    recurse => true,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    require => "Exec[mkdir_p-${docroot}]",
  }

  # needed for signing packages
  file { 'dot_rpmmacros':
    ensure  => file,
    path    => '/root/.rpmmacros',
    content => template('yum/rpmmacros.erb'),
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }

  exec { "mkdir_p-${docroot}":
    command => "mkdir -p ${docroot}",
    unless  => "test -d ${docroot}",
    path    => '/bin:/usr/bin',
  }

  apache::vhost { 'yumrepo':
    docroot       => $docroot,
    port          => '80',
    vhost_name    => $http_listen_ip,
    servername    => $servername,
    serveraliases => $serveraliases,
    serveradmin   => $contact_email,
    options       => ['Indexes','FollowSymLinks','MultiViews'],
    override      => ['AuthConfig'],
    require       => "Exec[mkdir_p-${docroot}]",
  }
}