forked from ros-infrastructure/mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathros_mirror.pp
109 lines (87 loc) · 2.7 KB
/
ros_mirror.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
include 'mirror'
include apt
class { 'unattended_upgrades':
auto => { 'reboot' => true },
}
package { 'git':
ensure => present
}
package { 'apt-mirror':
ensure => present,
# before => File['/mirror/packages.ros.org/mirror.list']
}
file {'/mirror/packages.ros.org/mirror.list':
ensure => file,
mode => '0664',
owner => 'rosmirror',
source => 'puppet:///modules/mirror/mirror.list',
}
file {['/mirror', '/mirror/packages.ros.org', '/mirror/packages.ros.org/mirror', '/mirror/packages.ros.org/mirror/packages.ros.org', '/mirror/packages.ros.org/mirror/packages.osrfoundation.org', '/mirror/wiki.ros.org', '/mirror/docs.ros.org']:
ensure => directory,
mode => '0644',
owner => 'rosmirror',
before => [ Apache::Vhost['packages.ros.org.mirror'],
File['/mirror/packages.ros.org/mirror.list'] ],
}
user {'rosmirror':
ensure => present,
before => File['/mirror/packages.ros.org'],
}
cron { 'docs.ros.org_mirror':
ensure => present,
command => "rsync -aqz rsync.osuosl.org::ros_docs_mirror /mirror/docs.ros.org --bwlimit=200 --copy-unsafe-links --delete",
user => 'rosmirror',
minute => [fqdn_rand(59)],
hour => [fqdn_rand(23)],
}
cron { 'wiki.ros.org_mirror':
ensure => present,
command => "rsync -aqz rsync.osuosl.org::ros_wiki_mirror /mirror/wiki.ros.org --bwlimit=200 --copy-unsafe-links --delete",
user => 'rosmirror',
minute => [fqdn_rand(59)],
hour => [fqdn_rand(23)],
}
cron { 'packages.ros.org_mirror':
ensure => present,
command => "apt-mirror /mirror/packages.ros.org/mirror.list",
user => 'rosmirror',
minute => [fqdn_rand(59)],
hour => [fqdn_rand(23)],
}
class { 'apache': }
apache::vhost{'docs.ros.org.mirror':
vhost_name => "*",
port => '80',
docroot => '/mirror/docs.ros.org',
serveraliases => ['*docs.ros.org*',],
}
apache::vhost{'wiki.ros.org.mirror':
vhost_name => "*",
port => '80',
docroot => '/mirror/wiki.ros.org',
override => 'All',
serveraliases => ['*wiki.ros.org*',],
}
apache::vhost{'packages.ros.org.mirror':
vhost_name => "*",
port => '80',
docroot => '/mirror/packages.ros.org/mirror/packages.ros.org',
serveraliases => ['*packages.ros.org*',],
}
apache::vhost{'packages.osrfoundation.org.mirror':
vhost_name => "*",
port => '80',
docroot => '/mirror/packages.ros.org/mirror/packages.osrfoundation.org',
serveraliases => ['*packages.osrfoundation.org*',],
}
apache::mod { 'headers': }
# for testing
host { 'localhost':
ip => '127.0.0.1',
host_aliases => ['docs.ros.org.example.com', 'wiki.ros.org.example.com', 'packages.ros.org.example.com',],
}
class {'rsync::server': }
rsync::server::module{'mirrorlogs':
path => '/var/log/apache2',
hosts_allow => ['web1.osuosl.org', 'ros.osuosl.org', 'localhost'],
}