Make reprepro useable on multiple mirrors

Ubuntu isn't the only thing we want to mirror, we may also want to
mirror debian or ceph packages and so on. Refactor the puppet so that it
is easier to do this in a reconsumable way.

Change-Id: I0a12bc4cb67339a7566fb113bbbc897d4f112f50
This commit is contained in:
Clark Boylan 2016-03-15 14:07:45 -07:00
parent 9703377a54
commit c929e3fb66
3 changed files with 29 additions and 28 deletions

View File

@ -58,11 +58,22 @@ class openstack_project::mirror_update (
]
}
class { '::openstack_project::reprepro':
confdir => '/etc/reprepro/ubuntu',
basedir => '/afs/.openstack.org/mirror/ubuntu',
distributions => 'openstack_project/reprepro/distributions.ubuntu.erb',
releases => ['trusty'],
# TODO(clarkb) this setup needs to go in a class of its own. It is not
# in the define because it is common to all reprepro mirrors.
package { 'reprepro':
ensure => present,
}
file { '/var/log/reprepro':
ensure => directory,
}
file { '/var/run/reprepro':
ensure => directory,
}
file { '/etc/reprepro':
ensure => directory,
}
file { '/etc/reprepro.keytab':
@ -84,16 +95,24 @@ class openstack_project::mirror_update (
ensure => absent,
}
::openstack_project::reprepro { 'ubuntu-reprepro-mirror':
confdir => '/etc/reprepro/ubuntu',
basedir => '/afs/.openstack.org/mirror/ubuntu',
distributions => 'openstack_project/reprepro/distributions.ubuntu.erb',
updates_file => 'puppet:///modules/openstack_project/reprepro/debuntu-updates',
releases => ['trusty'],
}
cron { 'reprepro ubuntu':
user => $user,
hour => '*/2',
command => 'flock -n /var/run/reprepro/ubuntu.lock reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu >>/var/log/reprepro/mirror.log 2>&1',
command => 'flock -n /var/run/reprepro/ubuntu.lock reprepro-mirror-update /etc/reprepro/ubuntu mirror.ubuntu >>/var/log/reprepro/ubuntu-mirror.log 2>&1',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
require => [
File['/usr/local/bin/reprepro-mirror-update'],
File['/etc/afsadmin.keytab'],
File['/etc/reprepro.keytab'],
Class['::openstack_project::reprepro'],
::openstack_project::reprepro['ubuntu-reprepro-mirror'],
]
}

View File

@ -1,35 +1,17 @@
# == Class: openstack_project::mirror_update
# == Define: openstack_project::mirror_update
#
class openstack_project::reprepro (
define openstack_project::reprepro (
$confdir,
$basedir,
$distributions,
$logdir = '/var/log/reprepro',
$updates_file = 'puppet:///modules/openstack_project/reprepro/updates',
$updates_file,
$options_template = 'openstack_project/reprepro/options.erb',
$releases = [],
) {
package { 'reprepro':
ensure => present,
}
file { $logdir:
ensure => directory,
}
file { '/etc/reprepro':
ensure => directory,
}
file { "$confdir":
ensure => directory,
}
file { '/var/run/reprepro':
ensure => directory,
}
file { "${confdir}/updates":
ensure => present,
owner => 'root',