dc81e2816f
puppet-httpd is the openstack-infra module for of puppetlabs-apache (0.0.4) release. This patchset will remove the puppetlabs-apache namespace from -infra allow for possible future patchsets to use newer puppetlabs-apache modules. Change-Id: Id9f08de5ca32eac884a01f11a2cf34e1044d3048 Depends-On: I4f4648538801a60f45b28cedc73b24d8905cfe14 Depends-On: Ifcc60d173430e30159aa794e5adb5ba71107e647 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
90 lines
2.0 KiB
Puppet
90 lines
2.0 KiB
Puppet
# == Class: openstack_project::pypi_mirror
|
|
#
|
|
class openstack_project::pypi_mirror (
|
|
$vhost_name,
|
|
$cron_frequency = '*/5',
|
|
) {
|
|
|
|
include ::httpd
|
|
|
|
if ! defined(File['/srv/static']) {
|
|
file { '/srv/static':
|
|
ensure => directory,
|
|
}
|
|
}
|
|
|
|
file { '/srv/static/mirror':
|
|
ensure => directory,
|
|
owner => 'root',
|
|
group => 'root',
|
|
}
|
|
|
|
file { '/srv/static/mirror/web':
|
|
ensure => directory,
|
|
owner => 'root',
|
|
group => 'root',
|
|
require => File['/srv/static/mirror'],
|
|
}
|
|
|
|
::httpd::vhost { $vhost_name:
|
|
port => 80,
|
|
priority => '50',
|
|
docroot => '/srv/static/mirror/web',
|
|
require => File['/srv/static/mirror/web'],
|
|
}
|
|
|
|
file { '/srv/static/mirror/web/robots.txt':
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0444',
|
|
source => 'puppet:///modules/openstack_project/disallow_robots.txt',
|
|
require => File['/srv/static/mirror/web'],
|
|
}
|
|
|
|
package { 'bandersnatch':
|
|
ensure => 'latest',
|
|
provider => 'pip',
|
|
}
|
|
|
|
file { '/etc/bandersnatch.conf':
|
|
ensure => present,
|
|
source => 'puppet:///modules/openstack_project/bandersnatch.conf',
|
|
}
|
|
|
|
file { '/var/log/bandersnatch':
|
|
ensure => directory,
|
|
}
|
|
|
|
file { '/var/run/bandersnatch':
|
|
ensure => directory,
|
|
}
|
|
|
|
cron { 'bandersnatch':
|
|
minute => $cron_frequency,
|
|
command => 'flock -n /var/run/bandersnatch/mirror.lock timeout -k 2m 30m run-bandersnatch >>/var/log/bandersnatch/mirror.log 2>&1',
|
|
environment => 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin',
|
|
}
|
|
|
|
include logrotate
|
|
logrotate::file { 'bandersnatch':
|
|
log => '/var/log/bandersnatch/mirror.log',
|
|
options => [
|
|
'compress',
|
|
'copytruncate',
|
|
'missingok',
|
|
'rotate 7',
|
|
'daily',
|
|
'notifempty',
|
|
],
|
|
}
|
|
|
|
file { '/usr/local/bin/run-bandersnatch':
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
source => 'puppet:///modules/openstack_project/run_bandersnatch.py',
|
|
}
|
|
}
|