![Michael Krotscheck](/assets/img/avatar_default.png)
This patch separates the creation of the bandersnatch pypi mirror from the creation of the apache vhost, and parameterizes the data directory in which bandersnatch places its packages. This is done so that we may reuse the pypi_mirror.pp module when building our new unified mirrors, which host pypi assets in a different directory and under a different hostname and URI. This patch should not trigger any changes on the existing mirrors. Change-Id: I55286df53d8dd84ea2377035b830cd92d378ad39
45 lines
1016 B
Puppet
45 lines
1016 B
Puppet
# == Class: openstack_project::pypi
|
|
#
|
|
class openstack_project::pypi (
|
|
$vhost_name = $::fqdn,
|
|
$sysadmins = [],
|
|
) {
|
|
|
|
class { 'openstack_project::server':
|
|
iptables_public_tcp_ports => [22, 80],
|
|
sysadmins => $sysadmins,
|
|
}
|
|
|
|
$mirror_root = '/srv/static'
|
|
$pypi_root = "${mirror_root}/mirror"
|
|
|
|
if ! defined(File[$mirror_root]) {
|
|
file { $mirror_root:
|
|
ensure => directory,
|
|
}
|
|
}
|
|
|
|
class { 'openstack_project::pypi_mirror':
|
|
data_directory => "${pypi_root}",
|
|
require => File[$mirror_root]
|
|
}
|
|
|
|
include ::httpd
|
|
|
|
::httpd::vhost { $vhost_name:
|
|
port => 80,
|
|
priority => '50',
|
|
docroot => "${pypi_root}/web",
|
|
require => Class['Openstack_project::Pypi_mirror'],
|
|
}
|
|
|
|
file { "${pypi_root}/web/robots.txt":
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0444',
|
|
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
|
|
require => Class['Openstack_project::Pypi_mirror'],
|
|
}
|
|
}
|