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
17
bacula/Makefile
Normal file
17
bacula/Makefile
Normal file
|
@ -0,0 +1,17 @@
|
|||
include $(CURDIR)/../Makefile.inc
|
||||
|
||||
VERSION = 5.2.13-1
|
||||
BASEURL = http://www.bacula-web.org/tl_files/downloads/
|
||||
PACKAGE = bacula-web-$(VERSION).tar.gz
|
||||
|
||||
all: manifest $(PACKAGES)/$(PACKAGE)
|
||||
|
||||
manifest: $(MANIFESTS)/bacula.pp
|
||||
|
||||
$(PACKAGES)/$(PACKAGE):
|
||||
@umask 022 ; echo $@ ; \
|
||||
curl -o $@ $(BASEURL)/$(PACKAGE)
|
||||
|
||||
$(MANIFESTS)/bacula.pp:
|
||||
@umask 022 ; echo $@ ; \
|
||||
echo '$$bacula_package_latest = "$(PACKAGE)"' > $@
|
|
@ -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: }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
25
bacula/templates/bacula-web.conf.erb
Normal file
25
bacula/templates/bacula-web.conf.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
// Show inactive clients (false by default)
|
||||
$config['show_inactive_clients'] = true;
|
||||
|
||||
// Hide empty pools (displayed by default)
|
||||
$config['hide_empty_pools'] = false;
|
||||
|
||||
// Translations
|
||||
$config['language'] = 'en_US';
|
||||
|
||||
// Server definition
|
||||
$config[0]['label'] = 'Bacula Server';
|
||||
<% if @dbadapter == 'sqlite' -%>
|
||||
$config[0]['db_type'] = 'sqlite';
|
||||
$config[0]['db_name'] = '/srv/bacula/bacula.db';
|
||||
<% else -%>
|
||||
$config[0]['host'] = '<%= @dbserver %>';
|
||||
$config[0]['login'] = '<%= @dbuser %>';
|
||||
$config[0]['password'] = '<%= @dbpassword %>';
|
||||
$config[0]['db_name'] = '<%= @dbname %>';
|
||||
$config[0]['db_type'] = 'mysql';
|
||||
<% end -%>
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue