system-config/modules/openstack_project/manifests/mirror.pp
Paul Belanger 2391536525
Update logrotate for mirror server
Since this is currently unmanaged by openstack-infra, the default is
to rotate logs every week, 52 times.  Needless to say, we are running
out of HDD space.  Now we rotate every day, 7 times.  This will cut
down on the amount of HDD space apache2 logs require.

Change-Id: I7baf62a36432f5d322e7f63e8c89bd6205974ca8
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-08-18 20:04:54 -04:00

212 lines
4.4 KiB
Puppet

# == Class: openstack_project::mirror
#
class openstack_project::mirror (
$vhost_name = $::fqdn,
) {
$mirror_root = '/afs/openstack.org/mirror'
$pypi_root = "${mirror_root}/pypi"
$wheel_root = "${mirror_root}/wheel"
$npm_root = "${mirror_root}/npm"
$ceph_deb_hammer_root = "${mirror_root}/ceph-deb-hammer"
$ceph_deb_jewel_root = "${mirror_root}/ceph-deb-jewel"
$www_base = '/var/www'
$www_root = "${www_base}/mirror"
#####################################################
# Build Apache Webroot
file { "${www_base}":
ensure => directory,
owner => root,
group => root,
}
file { "${www_root}":
ensure => directory,
owner => root,
group => root,
require => [
File["${www_base}"],
]
}
# Create the symlink to pypi.
file { "${www_root}/pypi":
ensure => link,
target => "${pypi_root}/web",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to wheel.
file { "${www_root}/wheel":
ensure => link,
target => "${wheel_root}",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to centos
file { "${www_root}/centos":
ensure => link,
target => "${mirror_root}/centos",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to debian
file { "${www_root}/debian":
ensure => link,
target => "${mirror_root}/debian",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to Debian OpenStack Packaging Team reprepro.
file { "${www_root}/debian-openstack":
ensure => link,
target => "${mirror_root}/debian-openstack",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# 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,
target => "${mirror_root}/ubuntu",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
file { "${www_root}/npm":
ensure => link,
target => "${npm_root}",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to ceph-deb-hammer.
file { "${www_root}/ceph-deb-hammer":
ensure => link,
target => "${ceph_deb_hammer_root}",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to ceph-deb-jewel.
file { "${www_root}/ceph-deb-jewel":
ensure => link,
target => "${ceph_deb_jewel_root}",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to Ubuntu Cloud Archive.
file { "${www_root}/ubuntu-cloud-archive":
ensure => link,
target => "${mirror_root}/ubuntu-cloud-archive",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
# Create the symlink to MariaDB.
file { "${www_root}/mariadb":
ensure => link,
target => "${mirror_root}/mariadb",
owner => root,
group => root,
require => [
File["${www_root}"],
]
}
file { "${www_root}/robots.txt":
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
require => File["${www_root}"],
}
#####################################################
# Build VHost
include ::httpd
if ! defined(Httpd::Mod['rewrite']) {
httpd::mod { 'rewrite':
ensure => present,
}
}
if ! defined(Httpd::Mod['substitute']) {
httpd::mod { 'substitute':
ensure => present,
}
}
::httpd::vhost { $vhost_name:
port => 80,
priority => '50',
docroot => "${www_root}",
template => 'openstack_project/mirror.vhost.erb',
require => [
File["${www_root}"],
]
}
class { '::httpd::logrotate':
options => [
'daily',
'missingok',
'rotate 7',
'compress',
'delaycompress',
'notifempty',
'create 640 root adm',
],
}
}