Import rest of modules.

This commit is contained in:
Timo Mkinen 2009-08-20 00:24:14 +03:00
parent 02fa10f33c
commit 3f225ced9b
39 changed files with 2056 additions and 0 deletions

View file

@ -0,0 +1 @@

56
backuppc/files/hosts.in Normal file
View file

@ -0,0 +1,56 @@
#============================================================= -*-perl-*-
#
# Host file list for BackupPC.
#
# DESCRIPTION
#
# This file lists all the hosts that should be backed up by
# BackupPC.
#
# Each line in the hosts file contains three fields, separated
# by white space:
#
# - The host name. If this host is a static IP address this
# must the machine's IP host name (ie: something that can
# be looked up using nslookup or DNS). If this is a DHCP
# host then the host name must be the netbios name of the
# machine. It is possible to have a host name that contains
# spaces, but that is discouraged. Escape a space with "\", eg:
#
# craigs\ pc
#
# - DHCP flag. Set to 0 if this is a static IP address host
# or if the machine can be found using nmblookup. Otherwise,
# if the client can only be found by looking through the DHCP
# pool then set this to 1.
#
# - User name (unix login/email name) of the user who "owns"
# or uses this machine. This is the user who will be sent
# email about this machine, and this user will have permission
# to stop/start/browse/restore backups for this host. This
# user name must match the name the user authenticates with
# via apache.
#
# - Optional additional user names (comma separated, no white space) of
# users who are also allowed to stop/start/browse/restore backups
# for this client via the CGI interface. These users are not sent
# email. These do not need to be valid email names; they simply
# need to match the name the user authenticates with via apache.
#
# AUTHOR
# Craig Barratt <craig@arraycomm.com>
#
# COPYRIGHT
# Copyright (C) 2001 Craig Barratt
#
# See http://backuppc.sourceforge.net.
#
#========================================================================
#
# The first non-comment non-empty line gives the field names and should
# not be edited!!
#
host dhcp user moreUsers # <--- do not edit this line
#farside 0 craig jill,jeff # <--- example static IP host entry
#larson 1 bill # <--- example DHCP host entry

102
backuppc/manifests/init.pp Normal file
View file

@ -0,0 +1,102 @@
define backuppc::manualclient($ensure = "present", $operatingsystem = "default") {
@@file { "/etc/BackupPC/pc/${name}.pl":
ensure => "${ensure}",
source => [ "puppet:///files/backuppc/${fqdn}.pl",
"puppet:///files/backuppc/${operatingsystem}.pl",
"puppet:///files/backuppc/default.pl",
"puppet:///backuppc/default.pl", ],
mode => 0640,
owner => root,
group => backuppc,
tag => "backuppc",
require => File["/etc/BackupPC/pc"],
notify => Exec["generate-backuppc-hosts"],
}
}
class backuppc::client {
backuppc::manualclient { "${fqdn}":
ensure => present,
operatingsystem => "${operatingsystem}",
}
}
class backuppc::server {
package { "BackupPC":
ensure => installed,
}
file { [ "/export/backuppc",
"/export/backuppc/cpool",
"/export/backuppc/pc",
"/export/backuppc/pool",
"/export/backuppc/trash", ]:
ensure => directory,
mode => 0750,
owner => backuppc,
group => root,
require => Package["BackupPC"],
}
file { "/srv/backuppc":
ensure => "/export/backuppc",
require => File["/export/backuppc"],
}
file { "/var/lib/BackupPC":
ensure => "/srv/backuppc",
force => true,
require => File["/srv/backuppc"],
}
file { "/etc/BackupPC/config.pl":
ensure => present,
source => "puppet:///files/backuppc/config.pl",
mode => 0640,
owner => root,
group => backuppc,
require => Package["BackupPC"],
notify => Service["backuppc"],
}
file { "/etc/BackupPC/hosts.in":
ensure => present,
source => [ "puppet:///files/backuppc/hosts.in",
"puppet:///backuppc/hosts.in", ],
mode => 0644,
owner => root,
group => backuppc,
require => Package["BackupPC"],
notify => Exec["generate-backuppc-hosts"],
}
file { "/etc/BackupPC/pc":
ensure => directory,
purge => true,
mode => 0750,
owner => root,
group => backuppc,
require => Package["BackupPC"],
}
exec { "generate-backuppc-hosts":
command => '(cat /etc/BackupPC/hosts.in ; find /etc/BackupPC/pc/ -name \*.pl -exec basename {} .pl \; | sed -e "s/$/ 0 adm/") > /etc/BackupPC/hosts',
path => "/bin:/usr/bin:/sbin:/usr/sbin",
refreshonly => true,
require => File["/etc/BackupPC/hosts.in"],
notify => Service["backuppc"],
}
File <<| tag == "backuppc" |>>
service { "backuppc":
ensure => running,
enable => true,
require => Package["BackupPC"],
}
}