From 61bc92e97e7b921790951d28e915793af241507a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 22 Nov 2023 16:34:51 -1000 Subject: [PATCH] Remove legacy top-scope syntax --- README.md | 78 +++++++++++++------------- gen_puppet.rb | 10 ++-- manifests/profile/client.pp | 4 +- manifests/profile/director.pp | 2 +- manifests/profile/director/client.pp | 4 +- manifests/profile/director/fileset.pp | 6 +- manifests/profile/director/jobdefs.pp | 6 +- manifests/profile/director/messages.pp | 4 +- manifests/profile/director/pool.pp | 8 +-- manifests/profile/director/profile.pp | 2 +- manifests/profile/director/schedule.pp | 20 +++---- manifests/profile/director/storage.pp | 2 +- manifests/profile/storage.pp | 6 +- 13 files changed, 76 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index cb1d830..25f45fb 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Please note, this is only the minimal subset of an bareos configuration. You may ```puppet # Install and configure an Director Server $storage_password = 'Password of the storage instance', -class { '::bareos::profile::director': +class { 'bareos::profile::director': password => 'Password of the director instance itself', catalog_conf => { 'db_name' => 'bareos_catalog', @@ -66,7 +66,7 @@ class { '::bareos::profile::director': } # add storage server to the same machine -class { '::bareos::profile::storage': +class { 'bareos::profile::storage': password => $storage_password, archive_device => '/var/lib/bareos/storage', } @@ -94,7 +94,7 @@ class { 'bareos::profile::client': ``` ## Reference -All bareos configuration directives are reflected to an puppet define ressource. It has almost the following schema: ::bareos::**component**::**directive**. +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](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). @@ -108,7 +108,7 @@ This class will be automatically included when a resource is defined. Here you can define various behaviours for your setup. ```puppet -class { '::bareos': +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) @@ -119,7 +119,7 @@ class { '::bareos': } ``` ### Client/FileDaemon -`Class ::bareos::client` +`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`. @@ -127,20 +127,20 @@ 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 +#### 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 +#### 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 +#### 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` +`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`. @@ -148,13 +148,13 @@ 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 +#### 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 +#### 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. @@ -169,7 +169,7 @@ If you have more than one, you will be prompted to choose one when you start the ``` ### Director -`Class ::bareos::director` +`Class bareos::director` This class manages the bareos director service, packages and configuration directory. Parameters should be configured in the upper class `::bareos`. @@ -177,33 +177,33 @@ 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 +#### 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 +#### 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 +#### 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 +#### 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 +#### 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 +#### 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. @@ -225,7 +225,7 @@ FileSets do use `Include Exclude Items`, which are represented by hash. Hash val } ``` -#### Job - Define ::bareos::director::job +#### 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). @@ -252,43 +252,43 @@ Jobs does have `Run Script`, which is represented by hash. Hash values are only } } ``` -#### JobDefs - Define ::bareos::director::jobdefs +#### 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 +#### 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 +#### 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 +#### 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 +#### 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 +#### 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` +`Class bareos::monitor` This class manages the bareos (tray-) monitor package and configuration directory. Parameters should be configured in the upper class `::bareos`. @@ -296,22 +296,22 @@ 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 +#### 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 +#### 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 +#### 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 +#### Storage - Define bareos::monitor::storage The Storage resource defines the attributes of the Storages that are monitored by this Monitor. ### Storage -`Class ::bareos::storage` +`Class bareos::storage` This class manages the bareos storage service, packages and configuration directory. Parameters should be configured in the upper class `::bareos`. @@ -319,46 +319,46 @@ 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 +#### 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 +#### 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 +#### 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 +#### 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 +#### 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 +#### 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` +`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 +#### Director - Define bareos::webui::director Configures an director to use with the webui. diff --git a/gen_puppet.rb b/gen_puppet.rb index 35ac4b6..4f02f6d 100755 --- a/gen_puppet.rb +++ b/gen_puppet.rb @@ -103,7 +103,7 @@ def bareos_option(directive, schema) # print end of params puts ") { - include ::bareos::#{comp_name} + include bareos::#{comp_name} $_resource = '#{resource}' $_resource_dir = '#{resource.downcase}' @@ -145,11 +145,11 @@ def bareos_option(directive, schema) puts " file { \"${::bareos::#{comp_name}::config_dir}/${_resource_dir}/${name}.conf\": ensure => $ensure, - mode => $::bareos::file_mode, - owner => $::bareos::file_owner, - group => $::bareos::file_group, + mode => $bareos::file_mode, + owner => $bareos::file_owner, + group => $bareos::file_group, content => template('bareos/resource.erb'), - notify => Service[$::bareos::#{comp_name}::service_name]," + notify => Service[$bareos::#{comp_name}::service_name]," puts ' require => $_require_resource' unless res_requires.empty? puts ' } }' diff --git a/manifests/profile/client.pp b/manifests/profile/client.pp index 134bf51..21203ba 100644 --- a/manifests/profile/client.pp +++ b/manifests/profile/client.pp @@ -11,11 +11,11 @@ } # allow bareos server to connect - ::bareos::client::director { $name_dir: + bareos::client::director { $name_dir: password => $password, } - ::bareos::client::messages { 'Standard': + bareos::client::messages { 'Standard': description => 'Send relevant messages to the Director.', director => 'bareos-dir = all, !skipped, !restored', } diff --git a/manifests/profile/director.pp b/manifests/profile/director.pp index fc45604..67511cb 100644 --- a/manifests/profile/director.pp +++ b/manifests/profile/director.pp @@ -11,7 +11,7 @@ $storage_password = 'BareosStoragePleaseChangeMe', ) { # ensure bconsole is installed and can connect to director - ::bareos::console::director { $name_dir: + bareos::console::director { $name_dir: description => 'Bareos console credentials for local director', address => 'localhost', password => $password, diff --git a/manifests/profile/director/client.pp b/manifests/profile/director/client.pp index bf68e04..98916d8 100644 --- a/manifests/profile/director/client.pp +++ b/manifests/profile/director/client.pp @@ -10,12 +10,12 @@ } # configure client on bareos director - ::bareos::director::client { 'bareos-director-fd': + bareos::director::client { 'bareos-director-fd': description => 'Client resource of the Director itself.', password => $password, address => 'localhost', } - ::bareos::director::job { 'backup-bareos-fd': + bareos::director::job { 'backup-bareos-fd': job_defs => 'BackupBareosCatalog', client => 'bareos-director-fd', messages => 'Standard', diff --git a/manifests/profile/director/fileset.pp b/manifests/profile/director/fileset.pp index 2afa16f..bfb5a4e 100644 --- a/manifests/profile/director/fileset.pp +++ b/manifests/profile/director/fileset.pp @@ -1,7 +1,7 @@ # == Class: bareos::profile::director::fileset # Default filesets class bareos::profile::director::fileset { - ::bareos::director::fileset { 'BareosCatalog': + bareos::director::fileset { 'BareosCatalog': description => 'Backup the catalog dump and Bareos configuration files.', include => { 'Options' => { @@ -19,7 +19,7 @@ }, } - ::bareos::director::fileset { 'LinuxAll': + bareos::director::fileset { 'LinuxAll': description => 'Backup all regular filesystems, determined by filesystem type.', include => { 'Options' => { @@ -67,7 +67,7 @@ }, } - ::bareos::director::fileset { 'WindowsAll': + bareos::director::fileset { 'WindowsAll': enable_vss => true, include => { 'Options' => { diff --git a/manifests/profile/director/jobdefs.pp b/manifests/profile/director/jobdefs.pp index 4587400..1db40e9 100644 --- a/manifests/profile/director/jobdefs.pp +++ b/manifests/profile/director/jobdefs.pp @@ -1,7 +1,7 @@ # == Class: bareos::profile::director::jobdefs # Default jobdefs class bareos::profile::director::jobdefs { - ::bareos::director::jobdefs { 'DefaultJob': + bareos::director::jobdefs { 'DefaultJob': type => 'backup', file_set => 'LinuxAll', # selftest storage => 'File', @@ -14,7 +14,7 @@ incremental_backup_pool => 'Incremental', } - ::bareos::director::jobdefs { 'BackupBareosCatalog': + bareos::director::jobdefs { 'BackupBareosCatalog': description => 'Backup the catalog database (after the nightly save)', job_defs => 'DefaultJob', level => 'Full', @@ -26,7 +26,7 @@ priority => 11, } - ::bareos::director::jobdefs { 'RestoreFiles': + bareos::director::jobdefs { 'RestoreFiles': description => 'Standard Restore template. Only one such job is needed for all standard Jobs/Clients/Storage ...', type => 'restore', file_set => 'LinuxAll', diff --git a/manifests/profile/director/messages.pp b/manifests/profile/director/messages.pp index 9ce1cf9..d530aa6 100644 --- a/manifests/profile/director/messages.pp +++ b/manifests/profile/director/messages.pp @@ -1,7 +1,7 @@ # == Class: bareos::profile::director::messages # Default messages class bareos::profile::director::messages { - ::bareos::director::messages { 'Daemon': + bareos::director::messages { 'Daemon': description => 'Message delivery for daemon messages (no job).', mail_command => '/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" %r', mail => 'root@localhost = all, !skipped, !audit', @@ -12,7 +12,7 @@ ], } - ::bareos::director::messages { 'Standard': + bareos::director::messages { 'Standard': description => 'Reasonable message delivery -- send most everything to email address and to the console.', operator_command => '/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r', mail_command => '/usr/bin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" %r', diff --git a/manifests/profile/director/pool.pp b/manifests/profile/director/pool.pp index 9251b54..75f47ad 100644 --- a/manifests/profile/director/pool.pp +++ b/manifests/profile/director/pool.pp @@ -1,7 +1,7 @@ # == Class: bareos::profile::director::pool # Some default pools class bareos::profile::director::pool { - ::bareos::director::pool { 'Differential': + bareos::director::pool { 'Differential': pool_type => 'Backup', recycle => true, auto_prune => true, @@ -11,7 +11,7 @@ label_format => 'Differential-', } - ::bareos::director::pool { 'Full': + bareos::director::pool { 'Full': pool_type => 'Backup', recycle => true, auto_prune => true, @@ -21,7 +21,7 @@ label_format => 'Full-', } - ::bareos::director::pool { 'Incremental': + bareos::director::pool { 'Incremental': pool_type => 'Backup', recycle => true, auto_prune => true, @@ -31,7 +31,7 @@ label_format => 'Incremental-', } - ::bareos::director::pool { 'Scratch': + bareos::director::pool { 'Scratch': pool_type => 'Scratch', } } diff --git a/manifests/profile/director/profile.pp b/manifests/profile/director/profile.pp index bb0aeb4..3915a94 100644 --- a/manifests/profile/director/profile.pp +++ b/manifests/profile/director/profile.pp @@ -20,7 +20,7 @@ } # this may be changed, so use sperate profile for webui - ::bareos::director::profile { 'webui-admin': + bareos::director::profile { 'webui-admin': description => 'bareos-webui webui-admin profile resource.', command_acl => [ '!.bvfs_clear_cache, !.exit, !.sql', diff --git a/manifests/profile/director/schedule.pp b/manifests/profile/director/schedule.pp index b833a5f..c2c88cd 100644 --- a/manifests/profile/director/schedule.pp +++ b/manifests/profile/director/schedule.pp @@ -2,7 +2,7 @@ # Default schedules class bareos::profile::director::schedule { # Default Cycles - ::bareos::director::schedule { 'WeeklyCycle': + bareos::director::schedule { 'WeeklyCycle': description => 'Default Backup shedule.', run => [ 'Full 1st sat at 21:00', @@ -11,12 +11,12 @@ ], } - ::bareos::director::schedule { 'WeeklyCycleAfterBackup': + bareos::director::schedule { 'WeeklyCycleAfterBackup': description => 'This schedule does the catalog backup.', run => 'Full mon-sun at 23:30', } - ::bareos::director::schedule { 'Hourly': + bareos::director::schedule { 'Hourly': run => [ 'Full daily at 01:00', 'Incremental hourly at 0:30', @@ -25,7 +25,7 @@ # These cycles are set up so that we can spread out the full backups of our # servers across the week. Some at the weekend, some mid-week. - ::bareos::director::schedule { 'WeeklyOnMonday': + bareos::director::schedule { 'WeeklyOnMonday': run => [ 'Full First Mon at 18:30', 'Differential Second-Fifth Mon at 18:30', @@ -33,7 +33,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnTuesday': + bareos::director::schedule { 'WeeklyOnTuesday': run => [ 'Full First Tue at 18:30', 'Differential Second-Fifth Tue at 18:30', @@ -41,7 +41,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnWednesday': + bareos::director::schedule { 'WeeklyOnWednesday': run => [ 'Full First Wed at 18:30', 'Differential Second-Fifth Wed at 18:30', @@ -49,7 +49,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnThursday': + bareos::director::schedule { 'WeeklyOnThursday': run => [ 'Full First Thu at 18:30', 'Differential Second-Fifth Thu at 18:30', @@ -57,7 +57,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnFriday': + bareos::director::schedule { 'WeeklyOnFriday': run => [ 'Full First Fri at 18:30', 'Differential Second-Fifth Fri at 18:30', @@ -65,7 +65,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnSaturday': + bareos::director::schedule { 'WeeklyOnSaturday': run => [ 'Full First Sat at 15:30', 'Differential Second-Fifth Sat at 15:30', @@ -73,7 +73,7 @@ ], } - ::bareos::director::schedule { 'WeeklyOnSunday': + bareos::director::schedule { 'WeeklyOnSunday': run => [ 'Full First Sun at 15:30', 'Differential Second-Fifth Sun at 15:30', diff --git a/manifests/profile/director/storage.pp b/manifests/profile/director/storage.pp index 3e9227e..56287a7 100644 --- a/manifests/profile/director/storage.pp +++ b/manifests/profile/director/storage.pp @@ -4,7 +4,7 @@ $address = 'localhost', $password = 'BareosStoragePleaseChangeMe', ) { - ::bareos::director::storage { 'File': + bareos::director::storage { 'File': address => $address, password => $password, device => 'FileStorage', diff --git a/manifests/profile/storage.pp b/manifests/profile/storage.pp index 320a734..bef228b 100644 --- a/manifests/profile/storage.pp +++ b/manifests/profile/storage.pp @@ -11,17 +11,17 @@ messages => 'Standard', } - ::bareos::storage::director { $name_dir: + bareos::storage::director { $name_dir: password => $password, } # Note: in the current implementation, the Director Name is ignored, and the message is sent to the Director that started the Job. - ::bareos::storage::messages { 'Standard': + bareos::storage::messages { 'Standard': description => 'Send relevant messages to the Director.', director => "${name_dir} = all", } - ::bareos::storage::device { 'FileStorage': + bareos::storage::device { 'FileStorage': archive_device => $archive_device, media_type => 'File', label_media => true,