Puppet Class: archvsync
- Defined in:
- manifests/init.pp
Overview
class: archvsync
base glance config.
parameters:
[*manage_apache*]
(Optional) Install and configure Apache.
Defaults to true
[*manage_pureftpd*]
(Optional) Install and configure pureftpd.
Defaults to true
[*manage_rsync*]
(Optional) Install and configure rsync, so that other mirror
can mirror us.
Defaults to true
[*configure_rsync*]
(Optional) Should this module tweak /etc/rsyncd.conf and /etc/default/rsync.
Defaults to true
[*package_ensure*]
(Optional) Ensure state for package.
Defaults to 'present'
[*mirrorname*]
(Optional) Name of the mirror.
Defaults to the hostname's FQDN.
[*to*]
(Optional) Mirror destination.
Defaults to '/home/ftp/debian/'
[*mailto*]
(Optional) Email of the ftpmaster.
Defaults to 'toto@example.com'
[*homedir*]
(Optional) Mirror FTP home.
Defaults to '/home/ftp'
[*hub*]
(Optional) HUB param.
Defaults to 'false'
[*rsync_host*]
(Optional) Source to rsync from.
Defaults to ftp.fr.debian.org.
[*rsync_path*]
(Optional) Rsync path in the rsync_host.
Defaults to 'debian'
[*also_sync_deb_cd*]
(Optional) Should we also rsync /debian-cd using regular Rsync?
Defaults to true
[*deb_cd_path*]
(Optional) Remote rsync path for the debian-cd repo
Defaults to debian-cd
[*also_sync_deb_security*]
(Optional) Should we also rsync /debian-security using regular Rsync?
Defaults to true
[*deb_security_path*]
(Optional) Remote rsync path for the debian-cd repo
Defaults to debian-security
[*also_sync_deb_archive*]
(Optional) Should we also rsync /debian-archive using regular Rsync?
Defaults to true
[*deb_archive_path*]
(Optional) Remote rsync path for the debian-archive repo
Defaults to debian-archive
[*also_sync_ubuntu*]
(Optional) Should we also rsync /debian-ubuntu using regular Rsync?
Defaults to true
[*ubuntu_path*]
(Optional) Remote rsync path for the ubuntu repo
Defaults to ubuntu
[*info_maintainer*]
(Optional) Maintainer name and email.
Defaults to 'Toor Op <root@localhost>'
[*info_sponsor*]
(Optional) Company sponsoring the mirror.
Defaults to 'World Company SA <https://www.example.com>'
[*info_country*]
(Optional) Country where the mirror will be hosted in.
Defaults to 'US'
[*info_location*]
(Optional) Location where the mirror will be hosted in.
Defaults to 'Nowhere city'
[*info_throughput*]
(Optional) Bandwidth speed of the mirror.
Defaults to '10Gb'
[*arch_include*]
(Optional) Architectures to mirror.
Defaults to 'amd64 source'
[*arch_exclude*]
(Optional) Architectures to mirror.
Defaults to ''
[*logdir*]
(Optional) Directory where logs will be written.
Defaults to '/home/ftp/log'
[*setup_daily_cron*]
(Optional) Install a cron job to do ftpsync every day.
Default to true
[*accept_push*]
(Optional) Switch to install a /home/ftp/.ssh/authorized_keys to allow
another mirror to send a push signal.
Default to false
[*push_signal_ssh_key*]
(Optional) Publish ssh key to accept the push
Default to undef
[*enable_runmirrors*]
(Optional) Should this server launch runmirrors to push to other
downstream servers
Default to false
[*runmirrors_hostnames*]
(Optional) List of downstream hostnames to push to.
Default to []
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'manifests/init.pp', line 142
class archvsync(
$manage_apache = true,
$manage_pureftpd = true,
$manage_rsync = true,
$configure_rsync = true,
$package_ensure = 'present',
$mirrorname = $::fqdn,
$to = '/home/ftp/debian/',
$mailto = 'toto@example.com',
$homedir = '/home/ftp',
$rsync_host = 'ftp.fr.debian.org',
$rsync_path = 'debian',
$also_sync_deb_cd = true,
$deb_cd_path = 'debian-cd',
$also_sync_deb_security = true,
$deb_security_path = 'debian-security',
$also_sync_deb_archive = true,
$deb_archive_path = 'debian-archive',
$also_sync_ubuntu = true,
$ubuntu_path = 'ubuntu',
$info_maintainer = 'Toor Op <root@localhost>',
$info_sponsor = 'World Company SA <https://www.example.com>',
$info_country = 'US',
$info_location = 'Nowhere city',
$info_throughput = '10Gb',
$arch_include = 'amd64 source',
$arch_exclude = '',
$logdir = '/home/ftp/log',
$setup_daily_cron = true,
$accept_push = false,
$push_ssh_key = undef,
$enable_runmirrors = false,
$runmirrors_hostnames = [],
) {
include ::archvsync::deps
$hub = $enable_runmirrors
if $arch_include == " " {
$arch_include_real = ""
}else{
$arch_include_real = $arch_include
}
group { 'ftp':
ensure => 'present',
}->
user { 'ftp':
ensure => 'present',
home => $homedir,
password => '!!',
password_max_age => '99999',
password_min_age => '0',
shell => '/bin/bash',
groups => ['ftp'],
}->
file { $homedir:
ensure => directory,
owner => ftp,
mode => '0755',
selinux_ignore_defaults => true,
}->
file { $to:
ensure => directory,
owner => ftp,
mode => '0755',
selinux_ignore_defaults => true,
}->
file { $logdir:
ensure => directory,
owner => ftp,
mode => '0755',
selinux_ignore_defaults => true,
}->
file { "${homedir}/.config":
ensure => directory,
owner => ftp,
mode => '0755',
selinux_ignore_defaults => true,
}->
file { "${homedir}/.config/ftpsync":
ensure => directory,
owner => ftp,
mode => '0755',
selinux_ignore_defaults => true,
}->
file { "${homedir}/.config/ftpsync/ftpsync.conf":
ensure => file,
owner => ftp,
mode => '0644',
selinux_ignore_defaults => true,
content => template("${module_name}/ftpsync.conf.erb"),
}->
package { 'ftpsync':
ensure => $package_ensure,
tag => ['archvsync-package'],
}
if $setup_daily_cron and $accept_push {
fail("Both setup_daily_cron and accept_push cannot be selected at once")
}
if $setup_daily_cron {
file { '/etc/cron.daily/ftpsync':
ensure => file,
owner => 'root',
mode => '0755',
selinux_ignore_defaults => true,
content => template("${module_name}/ftpsync.erb"),
require => Package['ftpsync']
}
}else{
file { '/etc/cron.daily/ftpsync':
ensure => absent,
}
}
# Configure push recieve
if $accept_push {
class { '::archvsync::acceptpush':
ssh_key => $push_ssh_key,
}
}else{
file { '/home/ftp/.ssh/authorized_keys':
ensure => absent,
}
}
if $also_sync_deb_cd or $also_sync_deb_security or $also_sync_deb_archive or $also_sync_ubuntu {
if $also_sync_deb_cd {
$rsync_deb_cd = "su ftp -c 'rsync -av ${rsync_host}::${$deb_cd_path} /home/ftp/debian-cd'"
}else{
$rsync_deb_cd = ''
}
if $also_sync_deb_security {
$rsync_deb_security = "su ftp -c 'rsync -av ${rsync_host}::${$deb_security_path} /home/ftp/debian-security'"
}else{
$rsync_deb_security = ''
}
if $also_sync_deb_archive {
$rsync_deb_archive = "su ftp -c 'rsync -av ${rsync_host}::${deb_archive_path} /home/ftp/debian-archive'"
}else{
$rsync_deb_archive = ''
}
if $also_sync_ubuntu {
$rsync_ubuntu = "su ftp -c 'rsync -av ${rsync_host}::${ubuntu_path} /home/ftp/ubuntu'"
}else{
$rsync_ubuntu = ''
}
$rsync_script = "#!/bin/sh
set -e
${rsync_deb_cd}
${rsync_deb_archive}
${rsync_ubuntu}
exit 0
"
$rsync_script_security = "#!/bin/sh
set -e
${rsync_deb_security}
exit 0
"
file { '/etc/cron.daily/archvsync-rsync':
ensure => file,
owner => 'root',
mode => '0755',
selinux_ignore_defaults => true,
content => $rsync_script,
require => Package['rsync']
}
file { '/etc/cron.hourly/archvsync-rsync':
ensure => file,
owner => 'root',
mode => '0755',
selinux_ignore_defaults => true,
content => $rsync_script_security,
require => Package['rsync']
}
}
# Configure Apache
if $manage_apache {
class { '::archvsync::apache': }
}
# Configure pure-ftpd
if $manage_pureftpd {
class { '::archvsync::pureftpd':
package_ensure => $package_ensure,
}
}
# Configure rsync, so we accept other servers to rsync us
if $manage_rsync {
class { '::archvsync::rsync':
configure_rsync => $configure_rsync,
}
}
# Configure so we can push to other servers
if $enable_runmirrors {
class { '::archvsync::runmirrors':
homedir => $homedir,
runmirrors_mailto => $mailto,
runmirrors_logdir => $logdir,
runmirrors_hostnames => $runmirrors_hostnames,
}
}
}
|