Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x
- Puppet >= 5.5.8 < 7.0.0
- , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'puppet-bareos', '1.0.0'
Learn more about managing modules with a PuppetfileDocumentation
Bareos Puppet Module
Table of Contents
- Description
- Setup requirements
- Reference
- Bareos common
- Client/Filedaemon
- Console (bconsole)
- Director
- Monitor (Tray)
- Storage
- Web UI
- Hiera
- Limitations - OS compatibility, etc.
Description
Bareos is a 100% open source fork of the backup project from bacula.org.
This puppet module configures and manage all aspects of an complex bareos installation. Unfortunately backups cannot be handled on an standard way, so this module tends to be flexible as possible. It is recommend to make familiar with the documentation of the configuration.
The bareos project is seperated into different parts which is reflected in this puppet module:
- Director - Heart of Bareos. The director manages all aspects of where, when and how to backup your systems.
- Client aka FileDaemon - Daemon which runs on the client to make backup of.
- Storage - An storage daemon which stores the backups.
- Console - Bconsole is an cli tool to work with the bareos director.
- Monitor - Tray Monitor
- WebUi - An Web Interface to work with the bareos director.
Setup Requirements
The module depends on the following puppet modules:
- Puppetlabs/stdlib - We use the following functions
delete_undef_values
anddowncase
. - Puppetlabs/concat - Only used for the
webui
configuration. - Puppetlabs/apt - Repository management for Debian based systems.
- Darin/zypprepo - Repository management for OpenSuSE/SLES
Usage with profiles
A good starting point is too look into the profile classes bareos::profile::director
,bareos::profile::storage
and bareos::profile::client
.
Please note, this is only the minimal subset of an bareos configuration. You may use only some of the default configurations such like the schedules, messages, filesets or profiles.
It is highly recommend not to use sqlite3 as bareos catalog backend. Please ensure you provide an mysql or postgresql database. See also define bareos::director::catalog
for the possible database configuration.
# Install and configure an Director Server
$storage_password = 'Password of the storage instance',
class { '::bareos::profile::director':
password => 'Password of the director instance itself',
catalog_conf => {
'db_driver' => 'mysql',
'db_name' => 'bareos_catalog',
'db_address' => 'fqdn',
'db_port' => 3306,
'db_user' => 'user',
'db_password' => 'password'
},
storage_address => 'localhost',
storage_password => $storage_password,
}
# add storage server to the same machine
class { '::bareos::profile::storage':
password => $storage_password,
archive_device => '/var/lib/bareos/storage',
}
# add the client to the config
::bareos::director::client { 'bareos-client':
description => 'Your fancy client to backup',
password => 'MyClientPasswordPleaseChange',
address => 'fqdn',
}
# Create an backup job by referencing to the jobDef template.
::bareos::director::job { 'backup-bareos-client':
job_defs => 'LinuxAll',
client => 'bareos-client', # which client to assign this job
}
# Install and configure an Client to backup
class { 'bareos::profile::client':
name_client => 'bareos-client',
password => 'MyClientPasswordPleaseChange',
}
Reference
All bareos configuration directives are reflected to an puppet define ressource. It has almost the following schema: ::bareos::component::directive.
There are only three exceptions were a class is used instead of an define: bareos::client::client
, bareos::director::director
and bareos::storage::storage
. They are only allowed to exist once a time in the bareos configuration.
While bareos has a lot of configuration settings, most of the documentation and available parameter are inside the puppet manifests. Please consult also the bareos documentation.
This puppet module tries to cover all aspects of (bareos) type validation on puppet catalog compilation through the puppet parser function bareos_settings
.
Class bareos
This class manages the bareos common package, user/group, repo and the base configuration directory.
This class will be automatically included when a resource is defined.
Here you can define various behaviours for your setup.
class { '::bareos':
repo_release => '16.2', # Highly recommend to fix your bareos release. Defaults to 'latest'
manage_repo => true, # use the internally shipped repo management
manage_user => true, # manage the bareos user and group (usually also created by the package)
manage_package => true, # setup the bareos-common packge
package_name => 'bareos-common', # change the common package name (can be an array as well),
package_ensure => present, # ensure all packages are present (affects all package components)
service_ensure => running, # ensure all services are running (affects all service components)
}
Client/FileDaemon
Class ::bareos::client
This class manages the bareos client (file-daemon) service, packages and configuration directory.
Parameters should be configured in the upper class ::bareos
.
This class will be automatically included when a resource is defined. It is not intended to be used directly by external resources like node definitions or other modules.
Client - Class ::bareos::client::client
The Client Resource (or FileDaemon) resource defines the name of the Client (as used by the Director) as well as the port on which the Client listens for Director connections.
Director - Define ::bareos::client::director
The Director resource defines the name and password of the Directors that are permitted to contact this Client.
Messages - Define ::bareos::client::messages
The Messages resource defines how messages are to be handled and destinations to which they should be sent.
Console
Class ::bareos::console
This class manages the bareos console (bconsole cli tool) package and configuration directory.
Parameters should be configured in the upper class ::bareos
.
This class will be automatically included when a resource is defined. It is not intended to be used directly by external resources like node definitions or other modules.
Console - Define ::bareos::console::Console
Usually not required to define. The bareos documentation is almost the same like in the director, but its unclear what it affects regarding the bconsole.
If someone has more information, feel free to add this info ;-).
Director - Define ::bareos::console::director
The Director resource defines the attributes of the Director running on the network. You may have multiple Director resource specifications in a single Console configuration file. If you have more than one, you will be prompted to choose one when you start the Console program.
::bareos::console::director { 'bareos-dir':
description => 'Bareos console credentials for director connection',
address => 'fqdn/ip to director',
password => 'password',
}
Director
Class ::bareos::director
This class manages the bareos director service, packages and configuration directory.
Parameters should be configured in the upper class ::bareos
.
This class will be automatically included when a resource is defined. It is not intended to be used directly by external resources like node definitions or other modules.
Director - Class ::bareos::director::director
To define the Director's name and its access password used for authenticating the Console program. Only a single Director resource definition may appear in the Director's configuration file.
Catalog - Define ::bareos::director::catalog
To define in what database to keep the list of files and the Volume names where they are backed up. Most people only use a single catalog. It is possible, however not adviced and not supported to use multiple catalogs.
Client - Define ::bareos::director::client
To define what Client is to be backed up. You will generally have multiple Client definitions. Each Job will reference only a single client.
Console - Define ::bareos::director::console
Configure an Named Console aka Restricted Console. Both the names and the passwords in these two entries must match much as is the case for Client programs.
Counter - Define ::bareos::director::counter
The Counter Resource defines a counter variable that can be accessed by variable expansion used for creating Volume labels with the Label Format Dir Pool directive.
FileSet - Define ::bareos::director::fileset
To define the set of files to be backed up for each Client. You may have any number of FileSets but each Job will reference only one.
FileSets do use Include Exclude Items
, which are represented by hash. Hash values are only allowed to have other hashes, string values or array of string values.
::bareos::director::fileset {'name':
include => {
'Options' => {
'Signature' => 'MD5',
'WildFile' => '/data/db*'
},
'File' => [
'/etc/',
'/var/lib'
]
}
}
Job - Define ::bareos::director::job
To define the backup/restore Jobs and to tie together the Client, FileSet and Schedule resources to be used for each Job. Normally, you will Jobs of different names corresponding to each client (i.e. one Job per client, but a different one with a different name for each client).
Jobs does have Run Script
, which is represented by hash. Hash values are only allowed to have other hashes, string values or array of string values (like the Include Exclude Items in Fileset).
::bareos::director::job { 'MyJob':
client => 'client resource name to backup'
file_set => 'fileset resource name',
schedule_res => 'Schedule resource name'
storage => 'storage resource name' or ['first storage', 'second storage'],
pool => 'Incremental',
messages => 'Standard',
priority => 10,
write_bootstrap => '/var/lib/bareos/%c.bsr',
full_backup_pool => 'Full',
differential_backup_pool => 'Differential',
incremental_backup_pool => 'Incremental',
run_script => {
'console' => '"update jobid=%i jobtype=A"'
'Runs When' => 'After',
'Runs On Client' => 'No',
'Runs on Failure' => 'No',
}
}
JobDefs - Define ::bareos::director::jobdefs
JobDefs are optional resources for providing defaults for Job resources.
Almost the same like Job
.
Messages - Define ::bareos::director::messages
To define where error and information messages are to be sent or logged. You may define multiple different message resources and hence direct particular classes of messages to different users or locations (files, ...).
Pool - Define ::bareos::director::pool
To define the pool of Volumes that can be used for a particular Job. Most people use a single default Pool. However, if you have a large number of clients or volumes, you may want to have multiple Pools. Pools allow you to restrict a Job (or a Client) to use only a particular set of Volumes.
Profile - Define ::bareos::director::profile
The Profile Resource defines a set of ACLs. Console Resources can be tight to one or more profiles, making it easier to use a common set of ACLs.
Schedule - Define ::bareos::director::schedule
The Schedule resource provides a means of automatically scheduling a Job as well as the ability to override the default Level, Pool, Storage and Messages resources. If a Schedule resource is not referenced in a Job, the Job can only be run manually. In general, you specify an action to be taken and when.
Storage - Define ::bareos::director::storage
To define on what physical device the Volumes should be mounted. You may have one or more Storage definitions.
Monitor
Class ::bareos::monitor
This class manages the bareos (tray-) monitor package and configuration directory.
Parameters should be configured in the upper class ::bareos
.
This class will be automatically included when a resource is defined. It is not intended to be used directly by external resources like node definitions or other modules.
Client - Define ::bareos::monitor::client
The Client resource defines the attributes of the Clients that are monitored by this Monitor.
Director - Define ::bareos::monitor::director
The Director resource defines the attributes of the Directors that are monitored by this Monitor.
Monitor - Define ::bareos::monitor::monitor
The Monitor resource defines the attributes of the Monitor running on the network. The parameters you define here must be configured as a Director resource in Clients and Storages configuration files, and as a Console resource in Directors configuration files.
Storage - Define ::bareos::monitor::storage
The Storage resource defines the attributes of the Storages that are monitored by this Monitor.
Storage
Class ::bareos::storage
This class manages the bareos storage service, packages and configuration directory.
Parameters should be configured in the upper class ::bareos
.
This class will be automatically included when a resource is defined. It is not intended to be used directly by external resources like node definitions or other modules.
Storage - Class ::bareos::storage::storage
In general, the properties specified under the Storage resource define global properties of the Storage daemon.
Autochange - Define ::bareos::storage::autochanger
The Autochanger resource supports single or multiple drive autochangers by grouping one or more Device resources into one unit called an autochanger in Bareos (often referred to as a "tape library" by autochanger manufacturers).
Device - Define ::bareos::storage::device
The Device Resource specifies the details of each device (normally a tape drive) that can be used by the Storage daemon. There may be multiple Device resources for a single Storage daemon. In general, the properties specified within the Device resource are specific to the Device.
Director - Define ::bareos::storage::director
The Director resource specifies the Name of the Director which is permitted to use the services of the Storage daemon. There may be multiple Director resources. The Director Name and Password must match the corresponding values in the Director's configuration file.
Messages - Define ::bareos::storage::messages
The Messages resource defines how messages are to be handled and destinations to which they should be sent.
NDMP - Define ::bareos::storage::ndmp
The NDMP Resource specifies the authentication details of each NDMP client. There may be multiple NDMP resources for a single Storage daemon. In general, the properties specified within the NDMP resource are specific to one client.
WebUI
Class ::bareos::webui
This class manages the bareos webui service, package and configuration.
This class will be automatically included when a resource is defined.
Director - Define ::bareos::webui::director
Configures an director to use with the webui.
Additional configuration is required on the Director server.
# Allow access from the webui to the director
# Add user admin
::bareos::director::console { 'admin':
password => 'admin',
profile => 'webui-admin',
}
::bareos::director::profile {'webui-admin':
description => 'bareos-webui webui-admin profile resource.',
command_acl => [
'!.bvfs_clear_cache, !.exit, !.sql',
'!configure, !create, !delete, !purge, !sqlquery, !umount, !unmount',
'*all*',
],
catalog_acl => '*all*',
client_acl => '*all*',
file_set_acl => '*all*',
job_acl => '*all*',
plugin_options_acl => '*all*',
pool_acl => '*all*',
schedule_acl => '*all*',
storage_acl => '*all*',
where_acl => '*all*',
}
Hiera
Since define ressource are used in the module they can not be used directly via hiera. Execptions are ofcourse the three classes mentioned in Reference.
But there exist hashes for the configuration directives in the bareos::director
and the bareos::webui
classes which can be used via hiera.
classes:
- bareos::director
bareos::director::director::name_director: 'example'
bareos::director::director::password: 'foobar'
bareos::director::catalogs:
'testing':
db_driver: 'postgresql'
db_name: 'test'
bareos::director::clients:
'alice':
address: foo.bar
password: foobar
bareos::director::jobs:
'backup-alice':
messages: testing
pool: testing
type: backup
client: alice
file_set: testing
## Limitations
This module is built upon and tested against the versions of Puppet listed in the metadata.json file (i.e. the listed compatible versions on the Puppet Forge).
OS Limitations hardly depends on the availability of the bareos packages in the bareos [repository](http://download.bareos.org/bareos/release/) and the available release. Currently it has been tested on Ubuntu 14.04 and 16.04.
## Module Migration
This puppet module was originally hosted at https://github.com/Project0/puppet-bareos and has been migrated to Vox Pupuli.
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v1.0.0 (2020-09-25)
Implemented enhancements:
- possibility to configure webui::director via hiera #37
- Add possibility to configure defined types via hiera #54 (benibr)
- configurable $config_director_dirs with purge option #43 (benibr)
Fixed bugs:
- bugfix: support fact os.name VirtuozzoLinux #48 (benibr)
- Allow puppetlabs/concat 6.x, puppetlabs/stdlib 6.x #40 (dhoppe)
Closed issues:
- support Virtuozzolinux OS.name with facter 3.14.2 #47
- configurable $config_director_dirs with purge option #42
- possibility to configure all defined types via hiera #41
Merged pull requests:
- added possibility to config storage defined types via hiera #64 (benibr)
- Bugfix/fix hashes cnts dirs #58 (benibr)
- modulesync 3.0.0 / Drop Ubuntu 12.04 and 14.04 / Drop Debian 7 and 8 / Drop CentOS 5 #53 (dhoppe)
- multiple Puppetlint fixes #45 (bastelfreak)
- Issue #37 added directors hash for config via hiera #38 (benibr)
- Prepare migration to voxpupuli #36 (Project0)
0.4.0 (2019-05-04)
Fixed bugs:
- Upgrade of fd fails on Ubuntu Xenial #25
- Workaround duplicate configs on package upgrades #26 (Project0)
Closed issues:
Merged pull requests:
- Some fixes #35 (Project0)
- Introduce manage_database flag #34 (mattiasgiese)
- Puppet6 compatible bareos_settings.rb #33 (benibr)
- Update dependency on puppetlabs/apt #31 (towo)
- Replace :undef with nil #29 (towo)
- Allow numbers in directive config keys #28 (philippdieter)
0.3.1 (2018-05-06)
Fixed bugs:
- bareos::director::messages has settings in the wrong order #17
- bareos::storage class has conditionals mixed up #16
- repository: Add missing / in yumrepo gpgkey URI. #13 (olifre)
- repository: Add descr for yum repository. #12 (olifre)
Closed issues:
- bareos::repository results in invalid url on debian #19
- Missing "/" in GPG URL for RHEL bases OS #14
Merged pull requests:
- Address must not be quoted #24 (Project0)
- set rspec-puppet version to last know #23 (Project0)
- repository: Fixed debian os version string #22 (laurigates)
- Fixed mixed up conditionals #21 (laurigates)
- Fix bareos mail and operator command order #20 (laurigates)
0.3.0 (2018-01-12)
Closed issues:
Merged pull requests:
- Fix repository with redhat based distributions and newer facter only versions #10 (Project0)
- Some minor fixes #8 (Project0)
0.2.1 (2017-08-18)
Merged pull requests:
- Fix US-ASCII chars and runscript can be an array #4 (Project0)
- type runscript can be specified as array with hashes #3 (Project0)
0.2.0 (2017-08-15)
Merged pull requests:
0.1.1 (2017-08-13)
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs/apt (>= 2.0.0 < 8.0.0)
- puppetlabs/concat (>= 4.1.0 < 7.0.0)
- puppetlabs/stdlib (>= 4.25.0 < 7.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.