Add EPEL mirror

Like the centos mirror, we'll be using rsync for the EPEL mirror. This
will be used by centos-7 nodes.

Change-Id: Ifb9f539b20558ef4464616d56259cf1355eff901
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-05-12 11:01:43 -04:00
parent a919e34237
commit 38a9cb4a1c
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
4 changed files with 85 additions and 0 deletions

View File

@ -565,6 +565,7 @@ node 'mirror-update.openstack.org' {
reprepro_keytab => hiera('reprepro_keytab'),
npm_keytab => hiera('npm_keytab'),
centos_keytab => hiera('centos_keytab'),
epel_keytab => hiera('epel_keytab'),
sysadmins => hiera('sysadmins', []),
}
}

View File

@ -0,0 +1,43 @@
#!/bin/bash -xe
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
MIRROR_VOLUME=$1
BASE="/afs/.openstack.org/mirror/epel"
MIRROR="rsync://mirror.math.princeton.edu/pub"
K5START="k5start -t -f /etc/epel.keytab service/epel-mirror -- timeout -k 2m 30m"
REPO=7
if ! [ -f $BASE/$REPO ]; then
$K5START mkdir -p $BASE/$REPO
fi
echo "Running rsync..."
$K5START rsync -rlptDvz \
--delete \
--delete-excluded \
--exclude="SRPMS" \
--exclude="ppc64" \
--exclude="ppc64le" \
--exclude="x86_64/debug" \
--exclude="x86_64/repoview" \
$MIRROR/epel/$REPO/ $BASE/$REPO/
# TODO(pabelanger): Validate rsync process
echo "rsyc completed successfully, running vos release."
k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v $MIRROR_VOLUME
echo "Done."

View File

@ -63,6 +63,17 @@ class openstack_project::mirror (
]
}
# Create the symlink to epel
file { "${www_root}/epel":
ensure => link,
target => "${mirror_root}/epel",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to apt.
file { "${www_root}/ubuntu":
ensure => link,

View File

@ -7,6 +7,7 @@ class openstack_project::mirror_update (
$admin_keytab = '',
$npm_keytab = '',
$centos_keytab = '',
$epel_keytab = '',
) {
class { 'openstack_project::server':
@ -223,4 +224,33 @@ class openstack_project::mirror_update (
File['/etc/centos.keytab'],
]
}
### EPEL mirror ###
file { '/etc/epel.keytab':
owner => 'root',
group => 'root',
mode => '0400',
content => $epel_keytab,
}
file { '/usr/local/bin/epel-mirror-update':
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/openstack_project/mirror/epel-mirror-update.sh',
}
cron { 'epel mirror':
user => $user,
minute => '0',
hour => '*/2',
command => 'flock -n /var/run/epel-mirror.lock epel-mirror-update mirror.epel >>/var/log/epel-mirror.log 2>&1',
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
require => [
File['/usr/local/bin/epel-mirror-update'],
File['/etc/afsadmin.keytab'],
File['/etc/epel.keytab'],
]
}
}