2016-01-20 15:11:24 -08:00
|
|
|
# == Class: openstack_project::mirror
|
|
|
|
#
|
|
|
|
class openstack_project::mirror (
|
|
|
|
$vhost_name = $::fqdn,
|
|
|
|
) {
|
|
|
|
|
2016-02-02 08:19:01 -08:00
|
|
|
$mirror_root = '/afs/openstack.org/mirror'
|
2016-05-10 15:52:05 -07:00
|
|
|
$pypi_root = "${mirror_root}/pypi"
|
2016-01-21 10:57:12 -08:00
|
|
|
$wheel_root = "${mirror_root}/wheel"
|
2016-04-13 08:30:14 -07:00
|
|
|
$npm_root = "${mirror_root}/npm"
|
2016-04-15 15:59:53 -04:00
|
|
|
$ceph_deb_hammer_root = "${mirror_root}/ceph-deb-hammer"
|
2016-01-21 10:57:12 -08:00
|
|
|
|
2016-01-22 16:02:32 -08:00
|
|
|
$www_base = '/var/www'
|
|
|
|
$www_root = "${www_base}/mirror"
|
2016-01-20 15:11:24 -08:00
|
|
|
|
2016-01-21 10:53:20 -08:00
|
|
|
#####################################################
|
|
|
|
# Build Apache Webroot
|
2016-01-22 16:02:32 -08:00
|
|
|
file { "${www_base}":
|
|
|
|
ensure => directory,
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
}
|
|
|
|
|
2016-01-21 10:53:20 -08:00
|
|
|
file { "${www_root}":
|
|
|
|
ensure => directory,
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
2016-01-22 16:02:32 -08:00
|
|
|
require => [
|
|
|
|
File["${www_base}"],
|
|
|
|
]
|
2016-01-21 10:53:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create the symlink to pypi.
|
|
|
|
file { "${www_root}/pypi":
|
|
|
|
ensure => link,
|
|
|
|
target => "${pypi_root}/web",
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-01-21 10:57:12 -08:00
|
|
|
# Create the symlink to wheel.
|
|
|
|
file { "${www_root}/wheel":
|
|
|
|
ensure => link,
|
|
|
|
target => "${wheel_root}",
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-03-07 13:59:56 -05:00
|
|
|
# Create the symlink to centos
|
|
|
|
file { "${www_root}/centos":
|
|
|
|
ensure => link,
|
|
|
|
target => "${mirror_root}/centos",
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-07-11 10:22:45 -04:00
|
|
|
# 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}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-05-12 11:01:43 -04:00
|
|
|
# Create the symlink to epel
|
|
|
|
file { "${www_root}/epel":
|
|
|
|
ensure => link,
|
|
|
|
target => "${mirror_root}/epel",
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-02-06 09:48:59 -06:00
|
|
|
# Create the symlink to apt.
|
2016-02-08 11:58:53 -06:00
|
|
|
file { "${www_root}/ubuntu":
|
2016-02-06 09:48:59 -06:00
|
|
|
ensure => link,
|
2016-02-08 11:58:53 -06:00
|
|
|
target => "${mirror_root}/ubuntu",
|
2016-02-06 09:48:59 -06:00
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-04-13 08:30:14 -07:00
|
|
|
file { "${www_root}/npm":
|
|
|
|
ensure => link,
|
|
|
|
target => "${npm_root}",
|
|
|
|
owner => root,
|
|
|
|
group => root,
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-04-15 15:59:53 -04:00
|
|
|
# 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}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-06-15 19:45:52 +01:00
|
|
|
# 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}"],
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2016-01-21 10:53:20 -08:00
|
|
|
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,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 08:30:14 -07:00
|
|
|
if ! defined(Httpd::Mod['substitute']) {
|
|
|
|
httpd::mod { 'substitute':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-21 10:53:20 -08:00
|
|
|
::httpd::vhost { $vhost_name:
|
|
|
|
port => 80,
|
|
|
|
priority => '50',
|
|
|
|
docroot => "${www_root}",
|
|
|
|
template => 'openstack_project/mirror.vhost.erb',
|
|
|
|
require => [
|
|
|
|
File["${www_root}"],
|
|
|
|
]
|
|
|
|
}
|
2016-01-20 15:11:24 -08:00
|
|
|
}
|