bacula: Added bacula::web class for deploying bacula web interface.
This commit is contained in:
parent
85522baabd
commit
dde1b7de0f
3 changed files with 148 additions and 1 deletions
|
@ -145,7 +145,7 @@ class bacula::director($password=undef,
|
|||
}
|
||||
"mysql": {
|
||||
if !$dbpassword {
|
||||
fail("\$dbpassword is required for bacula::director")
|
||||
fail("\$dbpassword is required for bacula::director when using '${dbadapter} database")
|
||||
}
|
||||
}
|
||||
default: {
|
||||
|
@ -422,3 +422,108 @@ define bacula::device($device, $media) {
|
|||
|
||||
}
|
||||
|
||||
|
||||
# Install Bacula web interface
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# $htaccess:
|
||||
# Source path for htaccess file used for authentication and
|
||||
# authorization.
|
||||
# $webhosts:
|
||||
# Array containing virtual host names where bacula web will
|
||||
# will be installed.
|
||||
# $dbadapter:
|
||||
# Database type for catalog. Only sqlite and mysql are
|
||||
# supported. Defaults to sqlite.
|
||||
# $dbserver:
|
||||
# Database server address. Defaults to "localhost". Not needed
|
||||
# for sqlite.
|
||||
# $dbname:
|
||||
# Database name. Defaults to "bacula". Not needed for sqlite.
|
||||
# $dbuser:
|
||||
# Database user name. Defaults to "bacula". Not needed for sqlite.
|
||||
# $dbpassword:
|
||||
# Database password. Not needed for sqlite.
|
||||
#
|
||||
class bacula::web($htaccess,
|
||||
$webhosts=undef,
|
||||
$dbadapter="sqlite",
|
||||
$dbserver="localhost",
|
||||
$dbname="bacula",
|
||||
$dbuser="bacula",
|
||||
$dbpassword=undef) {
|
||||
|
||||
if $dbadapter != "sqlite" and !$dbpassword {
|
||||
fail("\$dbpassword is required for bacula::web when using '${dbadapter}' database")
|
||||
}
|
||||
|
||||
case $dbadapter {
|
||||
"mysql": {
|
||||
class { "php::mysql":
|
||||
before => File["/usr/local/src/bacula-web.tar.gz"],
|
||||
}
|
||||
}
|
||||
"sqlite": { }
|
||||
default: {
|
||||
fail("Invalid \$dbadapter '${dbadapter}' in bacula::web")
|
||||
}
|
||||
}
|
||||
|
||||
include php::gd
|
||||
include php::pdo
|
||||
|
||||
file { "/usr/local/src/bacula-web.tar.gz":
|
||||
ensure => present,
|
||||
source => "puppet:///files/packages/${bacula_package_latest}",
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
require => [ Class["php::gd"], Class["php::pdo"], ],
|
||||
}
|
||||
util::extract::tar { "/usr/local/share/bacula-web":
|
||||
ensure => latest,
|
||||
source => "/usr/local/src/bacula-web.tar.gz",
|
||||
require => File["/usr/local/src/bacula-web.tar.gz"],
|
||||
}
|
||||
|
||||
file { "/usr/local/share/bacula-web/.htaccess":
|
||||
ensure => present,
|
||||
source => $htaccess,
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
require => Util::Extract::Tar["/usr/local/share/bacula-web"],
|
||||
}
|
||||
|
||||
file { "/usr/local/share/bacula-web/application/config/config.php":
|
||||
ensure => present,
|
||||
content => template("bacula/bacula-web.conf.erb"),
|
||||
mode => "0644",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
require => File["/usr/local/share/bacula-web/.htaccess"],
|
||||
}
|
||||
|
||||
file { "/usr/local/share/bacula-web/application/view/cache":
|
||||
ensure => directory,
|
||||
mode => "0770",
|
||||
owner => $apache::sslserver::group,
|
||||
group => $apache::sslserver::group,
|
||||
require => Util::Extract::Tar["/usr/local/share/bacula-web"],
|
||||
}
|
||||
|
||||
define configwebhost() {
|
||||
file { "/srv/www/https/${name}/bacula":
|
||||
ensure => link,
|
||||
target => "/usr/local/share/bacula-web",
|
||||
owner => "root",
|
||||
group => "root",
|
||||
require => File["/srv/www/https/${name}"],
|
||||
}
|
||||
}
|
||||
if $webhosts {
|
||||
configwebhost { $webhosts: }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue