Skip to content

Commit

Permalink
Prepare v0.3.0, see CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
thbe committed Aug 11, 2016
1 parent 14d0225 commit 453573d
Show file tree
Hide file tree
Showing 17 changed files with 199 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fixtures:
forge_modules:
stdlib: "puppetlabs/stdlib"
mysql: "puppetlabs/mysql"
staging: "nanliu/staging"
stdlib: "puppetlabs-stdlib"
mysql: "puppetlabs-mysql"
staging: "nanliu-staging"
symlinks:
bareos: "#{source_dir}"
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.3.0 2016-08-11 thbe <project@bendler-net.de>
* Add bconsole configuration
* Add bareos-webui

0.2.3 2016-08-11 thbe <project@bendler-net.de>
* Fix config file typo

Expand Down
4 changes: 4 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
include bareos::config::mysql
include bareos::config::director
}

if $bareos::type_dir {
include bareos::config::webui
}
}
7 changes: 7 additions & 0 deletions manifests/config/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@
notify => Service[$bareos::params::service_director],
require => Package[$bareos::params::package_director];

$bareos::params::config_console:
ensure => file,
mode => '0640',
group => 'bareos',
content => template($bareos::params::config_console_template),
require => Package[$bareos::params::package_console];

$bareos::params::config_confd_catalog:
ensure => file,
mode => '0644',
Expand Down
32 changes: 32 additions & 0 deletions manifests/config/webui.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Class: bareos::config::webui
#
# This module manages bareos webui
#
# Parameters: This module has no parameters
#
# Actions: This module has no actions
#
# Requires: This module has no requirements
#
# Sample Usage:
#
class bareos::config::webui {

# Webui configuration
file {
$bareos::params::config_confd_webui_consoles:
ensure => file,
mode => '0644',
content => template($bareos::params::config_confd_webui_consoles_template),
notify => Service[$bareos::params::service_webui],
require => Package[$bareos::params::package_webui];

$bareos::params::config_confd_webui_profiles:
ensure => file,
mode => '0644',
content => template($bareos::params::config_confd_webui_profiles_template),
notify => Service[$bareos::params::service_webui],
require => Package[$bareos::params::package_webui];
}

}
14 changes: 13 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
# Specify if director components should be installed
# Default value is false
#
# * `type_webui`
# Specify if webui components should be installed
# Default value is false
#
# * `db_password`
# Specify the database password
# Default value is 0nly4install
Expand Down Expand Up @@ -60,6 +64,10 @@
# Specify the clients that should be backuped
# Default value is no client
#
# * `webui_user`
# Specify the webui user and password
# Default value is admin with webui-password-for-bareos
#
# Variables
# ----------
#
Expand Down Expand Up @@ -97,6 +105,7 @@
$type_fd = false,
$type_sd = false,
$type_dir = false,
$type_webui = false,
$db_password = $bareos::params::db_password,
$db_password_hash = $bareos::params::db_password_hash,
$client_password = $bareos::params::client_password,
Expand All @@ -105,14 +114,16 @@
$storage_daemon = $bareos::params::storage_daemon,
$mail_hub = $bareos::params::mail_hub,
$mail_group = $bareos::params::mail_group,
$backup_clients = []
$backup_clients = [],
$webui_user = { 'admin' => 'webui-password-for-bareos' }
) inherits bareos::params {

# Validate parameters
validate_bool($bareos::manage_repo)
validate_bool($bareos::type_fd)
validate_bool($bareos::type_sd)
validate_bool($bareos::type_dir)
validate_bool($bareos::type_webui)
validate_string($bareos::db_password)
validate_string($bareos::db_password_hash)
validate_string($bareos::client_password)
Expand All @@ -122,6 +133,7 @@
validate_string($bareos::mail_hub)
validate_string($bareos::mail_group)
validate_array($bareos::backup_clients)
validate_hash($bareos::webui_user)

# Start workflow
if $bareos::params::linux {
Expand Down
4 changes: 4 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@
if $bareos::type_dir {
include bareos::install::director
}

if $bareos::type_webui {
include bareos::install::webui
}
}
17 changes: 17 additions & 0 deletions manifests/install/webui.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Class: bareos::install::webui
#
# This class contain the packages for bareos webui installation
#
# Parameters: This module has no parameters
#
# Actions: This module has no actions
#
# Requires: This module has no requirements
#
# Sample Usage: include bareos::install::webui
#
class bareos::install::webui {

# Webui packages
package { $bareos::params::package_webui: ensure => installed; }
}
8 changes: 8 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$package_database_mysql = 'bareos-database-mysql'
$package_database_tools = 'bareos-database-tools'
$package_console = 'bareos-bconsole'
$package_webui = 'bareos-webui'

# Config definition
$config_file = '/etc/bareos/bareos-fd.conf'
Expand All @@ -38,6 +39,8 @@
$config_storage_template = 'bareos/etc/bareos-sd.conf.erb'
$config_director = '/etc/bareos/bareos-dir.conf'
$config_director_template = 'bareos/etc/bareos-dir.conf.erb'
$config_console = '/etc/bareos/bconsole.conf'
$config_console_template = 'bareos/etc/bconsole.conf.erb'
$config_confd_dir = '/etc/bareos/bareos-dir.d'
$config_confd_clients_dir = '/etc/bareos/bareos-dir.d/clients'
$config_confd_jobs_dir = '/etc/bareos/bareos-dir.d/jobs'
Expand Down Expand Up @@ -67,6 +70,10 @@
$config_confd_schedule_template = 'bareos/etc/bareos-dir.d/schedule.conf.erb'
$config_confd_storage = '/etc/bareos/bareos-dir.d/storage.conf'
$config_confd_storage_template = 'bareos/etc/bareos-dir.d/storage.conf.erb'
$config_confd_webui_consoles = '/etc/bareos/bareos-dir.d/webui-consoles.conf'
$config_confd_webui_consoles_template = 'bareos/etc/bareos-dir.d/webui-consoles.conf.erb'
$config_confd_webui_profiles = '/etc/bareos/bareos-dir.d/webui-profiles.conf'
$config_confd_webui_profiles_template = 'bareos/etc/bareos-dir.d/webui-profiles.conf.erb'

$config_confd_storage_dir = '/etc/bareos/bareos-sd.d'

Expand All @@ -80,6 +87,7 @@
$service_file_daemon = 'bareos-fd'
$service_storage = 'bareos-sd'
$service_director = 'bareos-dir'
$service_webui = 'httpd'
}
default : {
$linux = false
Expand Down
4 changes: 4 additions & 0 deletions manifests/run.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
if $bareos::type_dir {
include bareos::run::director
}

if $bareos::type_webui {
include bareos::run::webui
}
}
22 changes: 22 additions & 0 deletions manifests/run/webui.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Class: bareos::run::webui
#
# This module manages bareos webui
#
# Parameters: This module has no parameters
#
# Actions: This module has no actions
#
# Requires: This module has no requirements
#
# Sample Usage:
#
class bareos::run::webui {

# bareos webui service configuration
service {
$bareos::params::service_webui:
ensure => 'running',
enable => true,
require => Package[$bareos::params::package_webui];
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thbe-bareos",
"version": "0.2.3",
"version": "0.3.0",
"author": "thbe",
"summary": "Install a Bareos enterprise class backup instance",
"license": "GPL-3.0",
Expand Down
16 changes: 16 additions & 0 deletions spec/classes/bareos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:type_fd => true,
:type_sd => true,
:type_dir => true,
:type_webui => true,
:backup_clients => [ 'client01.example.local', 'client02.example.local' ]
}
}
Expand All @@ -30,16 +31,19 @@
it { is_expected.to contain_class('bareos::install::file') }
it { is_expected.to contain_class('bareos::install::storage') }
it { is_expected.to contain_class('bareos::install::director') }
it { is_expected.to contain_class('bareos::install::webui') }
it { is_expected.to contain_class('bareos::config') }
it { is_expected.to contain_class('bareos::config::user') }
it { is_expected.to contain_class('bareos::config::file') }
it { is_expected.to contain_class('bareos::config::storage') }
it { is_expected.to contain_class('bareos::config::mysql') }
it { is_expected.to contain_class('bareos::config::director') }
it { is_expected.to contain_class('bareos::config::webui') }
it { is_expected.to contain_class('bareos::run') }
it { is_expected.to contain_class('bareos::run::file') }
it { is_expected.to contain_class('bareos::run::storage') }
it { is_expected.to contain_class('bareos::run::director') }
it { is_expected.to contain_class('bareos::run::webui') }

it { is_expected.to contain_package('bareos-common').with_ensure('installed') }
it { is_expected.to contain_package('bareos-filedaemon').with_ensure('installed') }
Expand All @@ -53,6 +57,7 @@
it { is_expected.to contain_package('bareos-database-mysql').with_ensure('installed') }
it { is_expected.to contain_package('bareos-database-tools').with_ensure('installed') }
it { is_expected.to contain_package('bareos-bconsole').with_ensure('installed') }
it { is_expected.to contain_package('bareos-webui').with_ensure('installed') }

it { is_expected.to contain_package('bzip2').with_ensure('present') }

Expand All @@ -61,6 +66,7 @@
it { is_expected.to contain_file('/etc/bareos/bareos-fd.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-sd.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bconsole.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/populate_bareos_schema.sh').with_ensure('file') }

it { is_expected.to contain_file('/etc/bareos/bareos-dir.d').with_ensure('directory') }
Expand All @@ -79,6 +85,9 @@
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/pool.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/schedule.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/storage.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/storage.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/webui-consoles.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/webui-profiles.conf').with_ensure('file') }

it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/clients/client01.example.local.conf').with_ensure('file') }
it { is_expected.to contain_file('/etc/bareos/bareos-dir.d/jobs/client01.example.local.conf').with_ensure('file') }
Expand All @@ -90,6 +99,7 @@
it { is_expected.to contain_service('bareos-fd').with( 'ensure' => 'running', 'enable' => 'true') }
it { is_expected.to contain_service('bareos-sd').with( 'ensure' => 'running', 'enable' => 'true') }
it { is_expected.to contain_service('bareos-dir').with( 'ensure' => 'running', 'enable' => 'true') }
it { is_expected.to contain_service('httpd').with( 'ensure' => 'running', 'enable' => 'true') }

it { is_expected.to contain_exec('/etc/bareos/populate_bareos_schema.sh') }
it { is_expected.to contain_exec('rpm-key-import') }
Expand Down Expand Up @@ -136,6 +146,12 @@
expect(content).to match('/etc/bareos/bareos-dir.d/jobs')
end

it 'should generate valid content for webui-consoles.conf' do
content = catalogue.resource('file', '/etc/bareos/bareos-dir.d/webui-consoles.conf').send(:parameters)[:content]
expect(content).to match('Name = admin')
expect(content).to match('Password = webui-password-for-bareos')
end

case facts[:osfamily]
when 'RedHat'
else
Expand Down
6 changes: 6 additions & 0 deletions templates/etc/bareos-dir.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
@/etc/bareos/bareos-dir.d/fileset.conf
@/etc/bareos/bareos-dir.d/jobdefs.conf

<%- if scope.lookupvar("bareos::type_webui") -%>
### Include webui configuration ###
@/etc/bareos/bareos-dir.d/webui-consoles.conf
@/etc/bareos/bareos-dir.d/webui-profiles.conf
<%- end -%>

### Local client definitions ###
@/etc/bareos/bareos-dir.d/client-director.conf

Expand Down
20 changes: 20 additions & 0 deletions templates/etc/bareos-dir.d/webui-consoles.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### /etc/bareos/bareos-dir.d/webui-consoles.conf
#
# Preparations:
#
# include this configuration file in bareos-dir.conf by
# @/etc/bareos/bareos-dir.d/webui-consoles.conf
#
# managed by Puppet, local changes will be overwritten
#

#
# Restricted console used by bareos-webui
#
<% scope.lookupvar('bareos::webui_user').each do |user, password| -%>
Console {
Name = <%= user %>
Password = <%= password %>
Profile = webui
}
<% end -%>
25 changes: 25 additions & 0 deletions templates/etc/bareos-dir.d/webui-profiles.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### /etc/bareos/bareos-dir.d/webui-profiles.conf
#
# Preparations:
#
# include this configuration file in bareos-dir.conf by
# @/etc/bareos/bareos-dir.d/webui-profiles.conf
#
# managed by Puppet, local changes will be overwritten
#

#
# bareos-webui default profile resource
#
Profile {
Name = webui
CommandACL = status, messages, show, version, run, rerun, cancel, .api, .bvfs_*, list, llist, use, restore, .jobs, .filesets, .clients
Job ACL = *all*
Schedule ACL = *all*
Catalog ACL = *all*
Pool ACL = *all*
Storage ACL = *all*
Client ACL = *all*
FileSet ACL = *all*
Where ACL = *all*
}
13 changes: 13 additions & 0 deletions templates/etc/bconsole.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### /etc/bareos/bconsole.conf
#
# Bareos User Agent (or Console) Configuration File
#
# managed by Puppet, local changes will be overwritten
#

Director {
Name = BackupServerDirector
DIRport = 9101
address = <%= @fqdn %>
Password = <%= scope.lookupvar('bareos::client_password') %>
}

0 comments on commit 453573d

Please sign in to comment.