From 9fa84bfd8739783963d07b0e78513cf56ae35eb3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:04:00 -0700 Subject: [PATCH 001/311] removing redundant custom pools, seemed useless, changing attribute type for custom host pools --- .kitchen.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 9171e8f..6142348 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -36,5 +36,4 @@ suites: - role[bareos_server] attributes: bareos: - host_pools: true - custom_host_pools: true + host_pools: '1' From 29b2a616e76b6bd299c5fa5ae92877e2a82b4b3c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:13:02 -0700 Subject: [PATCH 002/311] refactoring pool attributes, potential client list, adding storage specific attributes, other comments --- attributes/default.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 134aef4..d1fce0a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -25,22 +25,23 @@ # Database default['bareos']['database_type'] = 'postgresql' # postgresql/mysql -default['bareos']['dbdriver'] = 'postgresql' +default['bareos']['dbdriver'] = 'postgresql' # postgresql/mysql default['bareos']['dbname'] = 'bareos' default['bareos']['dbuser'] = 'bareos' default['bareos']['dbpassword'] = '' -# Clients list -default['bareos']['clients'] = [] +# Clients +default['bareos']['clients'] = %w() +default['bareos']['host_pools'] = '0' # Default is disabled, normal pools, see below +default['bareos']['default_pool'] = 'Default' +default['bareos']['full_pool'] = 'Full-Pool' +default['bareos']['incremental_pool'] = 'Inc-Pool' +default['bareos']['differential_pool'] = 'Diff-Pool' default['bareos']['enable_vfulls'] = false # Needs more work within host template -default['bareos']['host_pools'] = false -default['bareos']['custom_host_pools'] = false -default['bareos']['host_full_pool'] = 'test-pool-Full' -default['bareos']['host_incremental_pool'] = 'test-pool-Inc' -default['bareos']['host_differential_pool'] = 'test-pool-Diff' # Storage Daemon -default['bareos']['tape'] = false +default['bareos']['storage']['tape'] = false # tape may have to be handled via custom wrapper cookbooks +default['bareos']['storage']['server'] = node['hostname'] # Director default['bareos']['dir_port'] = 9101 From ae2e3b03d9bc137d8a6b4c976904931661ad1e47 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:14:57 -0700 Subject: [PATCH 003/311] limiting this cookbook to debian 7 or so as we haven't tested directly on debain 8 yet --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c1a0e27..8aaae50 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '0.1.4' -supports 'debian', '>= 7.0' +supports 'debian', '~> 7.0' supports 'ubuntu', '>= 12.04' supports 'centos', '>= 6.0' From 5e1908ba39ca94959f8c5de96adc74c65fd7a3fe Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:15:41 -0700 Subject: [PATCH 004/311] major bump to capture the new changes, easier to limit versions incase things dont work for users --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 8aaae50..c989191 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.4' +version '0.2.0' supports 'debian', '~> 7.0' supports 'ubuntu', '>= 12.04' From 99765064409e9b858e59cb1020622a077a983c2c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:20:47 -0700 Subject: [PATCH 005/311] refactoring template logic, added solo and non-solo config setup, changed to utilizing client more rather than host in general, fixing dynamic host references --- recipes/server.rb | 111 +++++++++++++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 35 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index babd212..057d8f9 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -21,61 +21,102 @@ node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] -# Installation des services BAREOS - -package 'bareos-director' do - action :install -end - -package 'bareos-tools' do - action :install +# Install BAREOS Server Packages +%w( bareos-director bareos-tools ).each do |server_pkgs| + package server_pkgs do + action :install + end end if Chef::Config[:solo] bareos_clients = node['bareos']['clients'] else - bareos_clients = search(:node, 'roles:bareos_base') + bareos_clients = search(:node, 'roles:bareos_client') end -template '/etc/bareos/bareos-dir.conf' do - source 'bareos-dir.conf.erb' - mode 0640 - owner 'bareos' - group 'bareos' - variables( - db_driver: node['bareos']['dbdriver'], - db_name: node['bareos']['dbname'], - db_user: node['bareos']['dbuser'], - db_password: node['bareos']['dbpassword'], - db_address: node['bareos']['dbaddress'] - ) - notifies :run, 'execute[reload-dir]', :delayed +# Create hosts direcotry for host configs +directory '/etc/bareos/bareos-dir.d/clients/' do + owner 'root' + group 'root' + mode '0755' + action :create end # Handle seperate host config files -unless Chef::Config[:solo] +# Populate host config files based on: +# * with values from the default['bareos']['clients'] attribute +# - OR - +# * hosts with bareos_client role attached +bareos_clients.each do |client| + if Chef::Config[:solo] + template '/etc/bareos/bareos-dir.conf' do + source 'bareos-dir.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + db_driver: node['bareos']['dbdriver'], + db_name: node['bareos']['dbname'], + db_user: node['bareos']['dbuser'], + db_password: node['bareos']['dbpassword'], + db_address: node['bareos']['dbaddress'], + client_full_pool: "#{client}-Full-Pool", + client_inc_pool: "#{client}-Inc-Pool", + client_diff_pool: "#{client}-Diff-Pool" + ) + notifies :run, 'execute[reload-dir]', :delayed + end - # Create hosts direcotry for host configs - directory '/etc/bareos/bareos-dir.d/hosts/' do - owner 'root' - group 'root' - mode '0755' - action :create - end + template "/etc/bareos/bareos-dir.d/clients/#{client}.conf" do + source 'client.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: client, + client_full_pool: "#{client}-Full-Pool", + client_inc_pool: "#{client}-Inc-Pool", + client_diff_pool: "#{client}-Diff-Pool" + ) + notifies :run, 'execute[reload-dir]', :delayed + end - # Populate host config files based on hosts with bareos_base role in runlist - bareos_clients.each do - template "/etc/bareos/bareos-dir.d/hosts/#{node['hostname']}.conf" do - source 'host.conf.erb' + else + + template '/etc/bareos/bareos-dir.conf' do + source 'bareos-dir.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - bareos_clients: bareos_clients + db_driver: node['bareos']['dbdriver'], + db_name: node['bareos']['dbname'], + db_user: node['bareos']['dbuser'], + db_password: node['bareos']['dbpassword'], + db_address: node['bareos']['dbaddress'], + client_full_pool: "#{client['hostname']}-Full-Pool", + client_inc_pool: "#{client['hostname']}-Inc-Pool", + client_diff_pool: "#{client['hostname']}-Diff-Pool" ) notifies :run, 'execute[reload-dir]', :delayed end + + template "/etc/bareos/bareos-dir.d/clients/#{client['hostname']}.conf" do + source 'client.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: client['hostname'], + client_full_pool: "#{client['hostname']}-Full-Pool", + client_inc_pool: "#{client['hostname']}-Inc-Pool", + client_diff_pool: "#{client['hostname']}-Diff-Pool" + ) + notifies :run, 'execute[reload-dir]', :delayed + end + end + end execute 'reload-dir' do From ba926cb3f0277a4c007cd7fd12e7563447c6223f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 16:26:35 -0700 Subject: [PATCH 006/311] Updated Comments, Edited storage attributes, adding directory for custom sd configs via wrapper if desired, delaying service bits until end of chef run..better that way really --- recipes/storage.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/recipes/storage.rb b/recipes/storage.rb index 6af3d37..e8f7de6 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -15,18 +15,17 @@ # 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. -# +# Setup Storage Daemon Random Passwords node.set_unless['bareos']['sd_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] -# Installation du Storage daemon BAREOS - +# Install BAREOS Storage Daemon Packages package 'bareos-storage' do action :install end -# if node['bareos']['tape'] == 'true' +# if node['bareos']['storage']['tape'] == 'true' # package "bareos-storage-tape" do # action :install # end @@ -46,7 +45,15 @@ variables( bareos_server: bareos_server ) - notifies :run, 'execute[restart-sd]', :immediately + notifies :run, 'execute[restart-sd]', :delayed +end + +directory '/etc/bareos/bareos-sd.d' do + owner 'root' + group 'root' + mode '0755' + action :create + notifies :run, 'execute[restart-sd]', :delayed end execute 'restart-sd' do From 35d9690fdb4eac887dcb3ffc28af81be1d995a2f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:21:00 -0700 Subject: [PATCH 007/311] editing custom config locations, adding base pools, editing job def naming scheme, using hostname instead of fqdn, editing pool retention definitions --- templates/default/bareos-dir.conf.erb | 42 +++++++++++++++++++++------ 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 5eacb8c..8f37d71 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -1,5 +1,5 @@ <%# DIRECTOR TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= node['hostname'] %> # Local modifications will be overwritten. Director { @@ -17,7 +17,7 @@ Director { Job { Name = "<%= node['hostname'] %>-BackupCatalog" - JobDefs = "<%= node['hostname'] %>-Job" + JobDefs = "<%= node['hostname'] %>-JobDef" Level = Full FileSet="Catalog" Schedule = "WeeklyCycleAfterBackup" @@ -137,7 +137,31 @@ Pool { Pool Type = Backup Recycle = yes AutoPrune = yes - Volume Retention = 365 days + Volume Retention = 30 days +} + +Pool { + Name = Full-Pool + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 6 months +} + +Pool { + Name = Inc-Pool + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 2 months +} + +Pool { + Name = Diff-Pool + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 4 months } Pool { @@ -145,7 +169,7 @@ Pool { Pool Type = Backup Recycle = yes AutoPrune = yes - Volume Retention = 365 days + Volume Retention = 1 year Maximum Volume Bytes = 50G Maximum Volumes = 100 } @@ -155,9 +179,9 @@ Pool { Pool Type = Backup } -########################################################################## -# Other Stuff -########################################################################## +######################################### +# Custom Director Daemon Config Locations +######################################### -#working#################### -@|"sh -c 'for f in /etc/bareos/bareos-dir.d/hosts/*.conf ; do echo @${f} ; done'" +# Custom Client Configs +@|"sh -c 'for f in /etc/bareos/bareos-dir.d/clients/*.conf ; do echo @${f} ; done'" From 7dbfbdd747598a853319a86ec56529471da59eb8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:21:46 -0700 Subject: [PATCH 008/311] being consistent in using hostname over fqdn --- templates/default/bareos-fd.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index a01770c..a984e37 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -1,5 +1,5 @@ <%# FILE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= node['hostname'] %> # Local modifications will be overwritten. FileDaemon { From d3228d5f6b203cedf71507a72c1b661c64093750 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:22:25 -0700 Subject: [PATCH 009/311] adding ability to add custom storage daemon configs via wrapper recipes if desired --- templates/default/bareos-sd.conf.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 3d57a26..54f5663 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -1,5 +1,5 @@ <%# STORAGE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= node['hostname'] %> # Local modifications will be overwritten. Storage { @@ -35,3 +35,9 @@ Messages { Name = Standard director = backup-dir = all } + +######################################## +# Custom Storage Daemon Config Locations +######################################## + +@|"sh -c 'for f in /etc/bareos/bareos-sd.d/*.conf ; do echo @${f} ; done'" From c4797048c230344343759e90d18526c4ae074c67 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:23:33 -0700 Subject: [PATCH 010/311] updated role reference so it is using newer method --- test/integration/roles/bareos_server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/roles/bareos_server.json b/test/integration/roles/bareos_server.json index f078924..68cff4e 100644 --- a/test/integration/roles/bareos_server.json +++ b/test/integration/roles/bareos_server.json @@ -8,7 +8,7 @@ }, "chef_type": "role", "run_list": [ - "role[bareos_base]", + "role[bareos_client]", "recipe[chef-bareos::server]", "recipe[chef-bareos::database]", "recipe[chef-bareos::storage]", From 3fefe07599453af71a2080403466751584d90210 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:24:22 -0700 Subject: [PATCH 011/311] renaming this file, not showing in commit for some reason btu I did --- templates/default/client.conf.erb | 95 +++++++++++++++++++++++++ templates/default/host.conf.erb | 112 ------------------------------ 2 files changed, 95 insertions(+), 112 deletions(-) create mode 100644 templates/default/client.conf.erb delete mode 100644 templates/default/host.conf.erb diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb new file mode 100644 index 0000000..7a9178e --- /dev/null +++ b/templates/default/client.conf.erb @@ -0,0 +1,95 @@ +<%# HOST TEMPLATE %> +# Local modifications will be overwritten. +# Bareos Host Config for <%= @bareos_client %>-fd + +Client { + Name = <%= @bareos_client %>-fd + Address = <%= @bareos_client %> + Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon + File Retention = 30 days + Job Retention = 6 months + AutoPrune = no +} + +JobDefs { + Name = "<%= @bareos_client %>-JobDef" + Type = Backup + Level = Incremental + Client = <%= @bareos_client %>-fd + FileSet = "Full Set" + Schedule = "WeeklyCycle" + Storage = File + Messages = Standard + Pool = <%= node['bareos']['default_pool'] %> + # Each client can have its own Pool to help with certain cases +<% if node['bareos']['host_pools'] == '1' %> + FullBackupPool = <%= @client_full_pool %> + IncrementalBackupPool = <%= @client_inc_pool %> + DifferentialBackupPool = <%= @client_diff_pool %> +<% elsif node['bareos']['host_pools'] == '0' %> + FullBackupPool = <%= node['bareos']['full_pool'] %> + IncrementalBackupPool = <%= node['bareos']['incremental_pool'] %> + DifferentialBackupPool = <%= node['bareos']['differential_pool'] %> +<% else %> + # FullBackupPool = <%= node['bareos']['full_pool'] %> + # IncrementalBackupPool = <%= node['bareos']['incremental_pool'] %> + # DifferentialBackupPool = <%= node['bareos']['differential_pool'] %> +<% end %> + Priority = 10 + Write Bootstrap = "/var/lib/bareos/%c.bsr" +} + +# Default Job +Job { + Name = "<%= @bareos_client %>-Job" + JobDefs = "<%= @bareos_client %>-JobDef" +} + +# Restore Job +Job { + Name = "<%= @bareos_client %>-Restore" + Type = Restore + Client = <%= @bareos_client %>-fd + FileSet= "Full Set" + Storage = File +<% if node['bareos']['host_pools'] == '1' %> + Pool = <%= @client_full_pool %> +<% else %> + Pool = <%= node['bareos']['full_pool'] %> +<% end %> + Messages = Standard + Where = /tmp/<%= @bareos_client %>_restored/ +} + +<% if node['bareos']['enable_vfulls'] == '1' %> +# VirtualFull Job + <%# Need some logic here to determine whether to use %> + <%# VirtualFull backups or not %> +<% end %> + +<% if node['bareos']['host_pools'] == '1' %> +# Individual host pools for better storage utilization +Pool { + Name = <%= @client_full_pool %> + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 1 year +} + +Pool { + Name = <%= @client_inc_pool %> + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 30 days +} + +Pool { + Name = <%= @client_diff_pool %> + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 3 months +} +<% end %> diff --git a/templates/default/host.conf.erb b/templates/default/host.conf.erb deleted file mode 100644 index 3631e9b..0000000 --- a/templates/default/host.conf.erb +++ /dev/null @@ -1,112 +0,0 @@ -<%# HOST TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> -# Local modifications will be overwritten. - -<%# @bareos_clients.each do |client| %> -# Bareos Host Config for <%= node['hostname'] %>-fd - -Client { - Name = <%= node['hostname'] %>-fd - Address = <%= node['fqdn'] %> - Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon - File Retention = 30 days - Job Retention = 6 months - AutoPrune = no -} - -JobDefs { - Name = "<%= node['hostname'] %>-Job" - Type = Backup - Level = Incremental - Client = <%= node['hostname'] %>-fd - FileSet = "Full Set" - Schedule = "WeeklyCycle" - Storage = File - Messages = Standard - Pool = Scratch - # Each client can have its own Pool to help with certain cases -<% if node['bareos']['host_pools'] == true && node['bareos']['custom_host_pools'] == true %> - FullBackupPool = <%= node['bareos']['host_full_pool'] %> - IncrementalBackupPool = <%= node['bareos']['host_incremental_pool'] %> - DifferentialBackupPool = <%= node['bareos']['host_differential_pool'] %> -<% elsif node['bareos']['host_pools'] == true %> - FullBackupPool = <%= node['hostname'] %>-Full - IncrementalBackupPool = <%= node['hostname'] %>-Inc - DifferentialBackupPool = <%= node['hostname'] %>-Diff -<% else %> - # FullBackupPool = <%= node['bareos']['host_full_pool'] %> - # IncrementalBackupPool = <%= node['bareos']['host_incremental_pool'] %> - # DifferentialBackupPool = <%= node['bareos']['host_differential_pool'] %> -<% end %> - Priority = 10 - Write Bootstrap = "/var/lib/bareos/%c.bsr" -} - -# Default Job -Job { - Name = "<%= node['hostname'] %>-Job" - JobDefs = "<%= node['hostname'] %>-Job" -} - -# Restore Job -Job { - Name = "<%= node['hostname'] %>-Restore" - Type = Restore - Client = <%= node['hostname'] %>-fd - FileSet= "Full Set" - Storage = File -<% if node['bareos']['host_pools'] == true && node['bareos']['custom_host_pools'] == true %> - Pool = <%= node['bareos']['host_full_pool'] %> -<% elsif node['bareos']['host_pools'] == true %> - Pool = <%= node['hostname'] %>-Full -<% else %> - Pool = Default -<% end %> - Messages = Standard - Where = /tmp/<%= node['hostname'] %>_restored/ -} - -<% if node['bareos']['enable_vfulls'] == true %> -# VirtualFull Job - <%# Need some logic here to determine whether to use %> - <%# VirtualFull backups or not %> -<% end %> - -<% if node['bareos']['host_pools'] == true %> -# Individual host pools for better storage utilization -Pool { - <% if node['bareos']['custom_host_pools'] == true %> - Name = <%= node['bareos']['host_full_pool'] %> - <% else %> - Name = <%= node['hostname'] %>-Full - <% end %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 1 year -} - -Pool { - <% if node['bareos']['custom_host_pools'] == true %> - Name = <%= node['bareos']['host_incremental_pool'] %> - <% else %> - Name = <%= node['hostname'] %>-Inc - <% end %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 30 days -} - -Pool { - <% if node['bareos']['custom_host_pools'] == true %> - Name = <%= node['bareos']['host_differential_pool'] %> - <% else %> - Name = <%= node['hostname'] %>-Diff - <% end %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 3 months -} -<% end %> From 155976621c09ac8d5a6c369e96df135bb68e7041 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:25:05 -0700 Subject: [PATCH 012/311] going to different role structure for testing, this is just for consistency --- test/integration/roles/bareos_client.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/integration/roles/bareos_client.json diff --git a/test/integration/roles/bareos_client.json b/test/integration/roles/bareos_client.json new file mode 100644 index 0000000..58fc178 --- /dev/null +++ b/test/integration/roles/bareos_client.json @@ -0,0 +1,15 @@ +{ + "name": "bareos_client", + "description": "simple client role for a bareos box test", + "json_class": "Chef::Role", + "default_attributes": { + }, + "override_attributes": { + }, + "chef_type": "role", + "run_list": [ + "recipe[chef-bareos]" + ], + "env_run_lists": { + } +} From a3d6ff2a6038c2d3ff5d4ebb1dbe2643882edf76 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:26:24 -0700 Subject: [PATCH 013/311] removing old role, new is bareos_client --- test/integration/roles/bareos_base.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 test/integration/roles/bareos_base.json diff --git a/test/integration/roles/bareos_base.json b/test/integration/roles/bareos_base.json deleted file mode 100644 index 08eafd0..0000000 --- a/test/integration/roles/bareos_base.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "base", - "description": "simple base role for a bareos box test", - "json_class": "Chef::Role", - "default_attributes": { - }, - "override_attributes": { - }, - "chef_type": "role", - "run_list": [ - "recipe[chef-bareos]" - ], - "env_run_lists": { - } -} From 667e5f80ad715f3a4eea7b8d35550bdeccd81fcc Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 4 Sep 2015 17:47:53 -0700 Subject: [PATCH 014/311] adding this, seems to fix an issue installing libpq-dev --- .kitchen.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 6142348..067c13f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -8,6 +8,8 @@ provisioner: platforms: - name: debian-7.8 + run_list: + - recipe[apt] - name: ubuntu-12.04 run_list: From 66efd163cf9aabda2ccb4eb309187f1684b598a4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 18:53:46 -0700 Subject: [PATCH 015/311] added extra attribute to ..allow custom SD configs, restart fails when no files are found accordingly --- attributes/default.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/attributes/default.rb b/attributes/default.rb index d1fce0a..37eee15 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -42,6 +42,7 @@ # Storage Daemon default['bareos']['storage']['tape'] = false # tape may have to be handled via custom wrapper cookbooks default['bareos']['storage']['server'] = node['hostname'] +default['bareos']['storage']['custom_configs'] = '0' # Director default['bareos']['dir_port'] = 9101 From f8a86f46e56e35caf764aecc327c3ee1855cf84d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 18:59:17 -0700 Subject: [PATCH 016/311] cleanup and comment, changing reload-dir to restart on notify instead of reload --- recipes/server.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 057d8f9..0397688 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -15,8 +15,8 @@ # 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. -# +# Preparing Random Password for the director and mon node.set_unless['bareos']['dir_password'] = random_password(length: 30, mode: :base64) node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] @@ -66,7 +66,6 @@ ) notifies :run, 'execute[reload-dir]', :delayed end - template "/etc/bareos/bareos-dir.d/clients/#{client}.conf" do source 'client.conf.erb' owner 'bareos' @@ -80,9 +79,7 @@ ) notifies :run, 'execute[reload-dir]', :delayed end - else - template '/etc/bareos/bareos-dir.conf' do source 'bareos-dir.conf.erb' owner 'bareos' @@ -100,7 +97,6 @@ ) notifies :run, 'execute[reload-dir]', :delayed end - template "/etc/bareos/bareos-dir.d/clients/#{client['hostname']}.conf" do source 'client.conf.erb' owner 'bareos' @@ -114,15 +110,13 @@ ) notifies :run, 'execute[reload-dir]', :delayed end - end - end execute 'reload-dir' do command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' action :nothing - notifies :reload, 'service[bareos-dir]', :delayed + notifies :restart, 'service[bareos-dir]', :delayed end service 'bareos-dir' do From 08d81cd469a89b9e69808bb23d2585e8ebac0988 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 19:01:06 -0700 Subject: [PATCH 017/311] changing restart-sd to immediately --- recipes/storage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/storage.rb b/recipes/storage.rb index e8f7de6..64ea634 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -59,7 +59,7 @@ execute 'restart-sd' do command 'bareos-sd -t -c /etc/bareos/bareos-sd.conf' action :nothing - notifies :restart, 'service[bareos-sd]', :delayed + notifies :restart, 'service[bareos-sd]', :immediately end service 'bareos-sd' do From fee092d86c44c9a2b9de8c8f53fd7b3865e8ab20 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 19:01:49 -0700 Subject: [PATCH 018/311] adding conditional regarding custom configs, optional now --- templates/default/bareos-sd.conf.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 54f5663..653b240 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -36,8 +36,10 @@ Messages { director = backup-dir = all } +<% if node['bareos']['storage']['custom_configs'] == '1' %> ######################################## # Custom Storage Daemon Config Locations ######################################## @|"sh -c 'for f in /etc/bareos/bareos-sd.d/*.conf ; do echo @${f} ; done'" +<% end %> From 3b3dfd9291c8048ecbf2d1c95ba4d0e668d3477e Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 19:03:28 -0700 Subject: [PATCH 019/311] reordering runlist --- test/integration/roles/bareos_server.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/roles/bareos_server.json b/test/integration/roles/bareos_server.json index 68cff4e..d02712b 100644 --- a/test/integration/roles/bareos_server.json +++ b/test/integration/roles/bareos_server.json @@ -10,9 +10,9 @@ "run_list": [ "role[bareos_client]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::database]", + "recipe[chef-bareos::workstation]", "recipe[chef-bareos::storage]", - "recipe[chef-bareos::workstation]" + "recipe[chef-bareos::database]" ], "env_run_lists": { } From 972693dc3bc5c44152b8122048100716d3436255 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 19:12:07 -0700 Subject: [PATCH 020/311] reordering runlist --- test/integration/roles/bareos_server.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/roles/bareos_server.json b/test/integration/roles/bareos_server.json index d02712b..68cff4e 100644 --- a/test/integration/roles/bareos_server.json +++ b/test/integration/roles/bareos_server.json @@ -10,9 +10,9 @@ "run_list": [ "role[bareos_client]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::workstation]", + "recipe[chef-bareos::database]", "recipe[chef-bareos::storage]", - "recipe[chef-bareos::database]" + "recipe[chef-bareos::workstation]" ], "env_run_lists": { } From 6f08b99fd3d81a3a8620e962fa1bc4120b23b5b5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 20:11:00 -0700 Subject: [PATCH 021/311] updated changelog --- CHANGELOG.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 914eaea..358aa62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,25 @@ Bareos Cookbook CHANGELOG This file is used to list changes made in each version of the bareos cookbook. -0.1.4 +0.2.0 ----- - Ian smith + - Updating and validating Kitchen testing with new methods + - Adding ability to use custom Storage Daemon Configs via wrapper recipe + - Fixed a race condition that was likely to come up both in testing and production + * Was missing client config on fresh install so restart of dir would fail + - Limiting cookbook support for debian to ~>7.0 until we can test on 8+ + - Refined storage recipe to correctly create client configs based on BOTH role search and solo instances, may need a bit more tuning but should work in most cases + - Creating basic Full, Inc, and Diff pools even if not used, just as a place holder (default) + - Minor fixes + - Larger version bump for version clarity + - Updated Docs + +0.1.4 +----- +- Ian Smith + - Updating README - Revamping server.rb recipe to better utilize the bareos-dir.d directory * Moving ALL host config files to the bareos-dir.d/hosts/ directory @@ -22,7 +37,7 @@ This file is used to list changes made in each version of the bareos cookbook. 0.1.3 ----- -- Ian smith +- Ian Smith - Updating README - Updating CHANGELOG From 26a8d3d41d99b70a193573047b3b5dd6dea962c4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 20:11:16 -0700 Subject: [PATCH 022/311] Updated README --- README.md | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e03fe83..904bcd8 100644 --- a/README.md +++ b/README.md @@ -20,31 +20,33 @@ Attribute | Description |Type | Default ["bareos"]["dbname"] | Specify the database default name | string | 'bareos' ["bareos"]["dbuser"] | Specify the db user name | string | 'bareos' ["bareos"]["dbpassword"] | Specify the db password | string | '' -["bareos"]["dbaddress"] | Specify the db address | string | +["bareos"]["dbaddress"] | Specify the db address | string | nil ## General Attribute | Description |Type | Default -----------------|-------------|-----|-------- ['bareos']['url'] | Base URL for Bareos Repository | string | 'http://download.bareos.org/bareos/release' -['bareos']['version'] | Software Version | string | 'latest' +['bareos']['version'] | Software Version | string | '14.2' ## Storage Daemon Attribute | Description |Type | Default -----------------|-------------|-----|-------- ['bareos']['tape'] | Enable Tape Features | boolean | false +['bareos']['storage']['server'] | Define name of SD server | string | node['hostname'] +['bareos']['storage']['custom_configs'] | Allows custom SD configs via wrapper | string | '0' ## Clients/Hosts Attribute | Description |Type | Default -----------------|-------------|-----|-------- -['bareos']['clients'] | Monitor Clients | array | [] -['bareos']['enable_vfulls'] | Activate basic Virtual Full Backups | boolean | false -['bareos']['host_pools'] | Seperate Host Pools | boolean | false -['bareos']['custom_host_pools'] | Custom Host Pools | boolean | nil -['bareos']['host_full_pool'] | Custom Full Pool | string | 'test-pool-Full' -['bareos']['host_incremental_pool'] | Custom Incremental Pool | string | 'test-pool-Inc' -['bareos']['host_differential_pool'] | Custom Differential Pool | string | 'test-pool-Diff' +['bareos']['clients'] | Monitor Clients (Solo Mode only right now) | array | %w() +['bareos']['host_pools'] | Seperate Host Pools | string | '0' +['bareos']['default_pool'] | Basic Default Pool | string | 'Default' +['bareos']['full_pool'] | Basic Full Pool | string | 'Full-Pool' +['bareos']['incremental_pool'] | Basic Incremental Pool | string | 'Inc-Pool' +['bareos']['differential_pool'] | Basic Differential Pool | string | 'Diff-Pool' +['bareos']['enable_vfulls'] | Activate basic Virtual Full Backups (Not currently used, on radar though) | boolean | false ## Director @@ -66,12 +68,12 @@ Attribute | Description |Type | Default ### bareos_base role (install the bareos client backup by default) -You need to create a base role called ``bareos_base`` like this: +You need to create a client role called ``bareos_client`` like this: ``` { - "name": "bareos_base", - "description": "Base Role for chef-bareos Cookbook, used in searches, throws down sources for installs", + "name": "bareos_client", + "description": "Example Role for Bareos clients using the chef-bareos Cookbook, used in searches, throws down sources for installs", "json_class": "Chef::Role", "default_attributes": { }, @@ -87,14 +89,14 @@ You need to create a base role called ``bareos_base`` like this: ``` This role has to be applied to all your clients so they can be backed up by this cookbook. -### bareos_server role (install the bareos server for backups) +### bareos_server role (install the bareos server for scheduling backups) -For the server, you need a role named ``bareos_server``, for example : +For the primary server, if not splitting out services, you need a role named ``bareos_server``, for example : ``` { "name": "bareos_server", - "description": "Bareos Server Role", + "description": "Example Role for a Bareos server", "json_class": "Chef::Role", "default_attributes": { }, @@ -113,7 +115,10 @@ For the server, you need a role named ``bareos_server``, for example : } ``` -You need to run chef-client on the backup server every time you add a new node. All job will be automatically create for you. +You'll need to run chef-client on the backup server every time you add a new node. Client jobs should be created for you automatically. + +Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of clients. + # Contributing From c4051c08e8f1ddf32f1d2357795170b930187d8c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 20:12:08 -0700 Subject: [PATCH 023/311] aligning attribute comments with documentation --- attributes/default.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 37eee15..99af42f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -47,5 +47,7 @@ # Director default['bareos']['dir_port'] = 9101 default['bareos']['dir_max_concurrent_jobs'] = 20 + +# Subscription Management (Director) default['bareos']['dir_subscription'] = nil default['bareos']['dir_subs'] = nil From a73afe0bc6ce1c91162fded80b482c94d0ee7685 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 5 Sep 2015 20:24:40 -0700 Subject: [PATCH 024/311] travis didn't like my spacing here --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 99af42f..827517c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -32,7 +32,7 @@ # Clients default['bareos']['clients'] = %w() -default['bareos']['host_pools'] = '0' # Default is disabled, normal pools, see below +default['bareos']['host_pools'] = '0' # Default is disabled, normal pools, see below default['bareos']['default_pool'] = 'Default' default['bareos']['full_pool'] = 'Full-Pool' default['bareos']['incremental_pool'] = 'Inc-Pool' From f7cfbfe154ba01828062cb3737f5c77abb74191f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 8 Sep 2015 15:34:01 -0700 Subject: [PATCH 025/311] Capitalize --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 358aa62..105a628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ This file is used to list changes made in each version of the bareos cookbook. 0.2.0 ----- -- Ian smith +- Ian Smith - Updating and validating Kitchen testing with new methods - Adding ability to use custom Storage Daemon Configs via wrapper recipe From c0869aabb81d29c948fe65b4cbbd3a1de42f5c95 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 11:48:03 -0700 Subject: [PATCH 026/311] adding fedora testing/support --- .kitchen.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 067c13f..0b00024 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -23,6 +23,10 @@ platforms: - name: centos-7.0 + - name: fedora-20 + + - name: fedora-21 + data_bags_path: test/integration/data_bags/ roles_path: test/integration/roles/ environments_path: test/integration/environments From 70bf1b8e55c233d6b6ed10ff3d8de1b0970cb677 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 11:48:30 -0700 Subject: [PATCH 027/311] fixing typos --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 904bcd8..7e71a6c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Attribute | Description |Type | Default ## Roles -### bareos_base role (install the bareos client backup by default) +### bareos_client role (install the bareos client backup by default) You need to create a client role called ``bareos_client`` like this: @@ -81,7 +81,7 @@ You need to create a client role called ``bareos_client`` like this: }, "chef_type": "role", "run_list": [ - "recipe[bareos]" + "recipe[chef-bareos]" ], "env_run_lists": { } @@ -104,11 +104,11 @@ For the primary server, if not splitting out services, you need a role named ``b }, "chef_type": "role", "run_list": [ - "role[bareos_base]", - "recipe[bareos::server]", - "recipe[bareos::database]", - "recipe[bareos::storage]", - "recipe[bareos::workstation]" + "role[bareos_client]", + "recipe[chef-bareos::server]", + "recipe[chef-bareos::database]", + "recipe[chef-bareos::storage]", + "recipe[chef-bareos::workstation]" ], "env_run_lists": { } From 96c7eb84bee2549b5e9a326785b0e85944b8f555 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 11:50:38 -0700 Subject: [PATCH 028/311] fixing centos7 repos, adding fedora repos,refactoring attribute scheme, adding more attribute options --- attributes/default.rb | 79 +++++++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 21 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 827517c..60a15f3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -6,7 +6,7 @@ # default['bareos']['version'] = 'latest' <--- Could be dangerous, ***CAUTION*** default['bareos']['version'] = '14.2' # <--- Latest version as of 6-26-15 -if platform_family?('rhel') +if platform_family?('rhel', 'fedora') default['bareos']['yum_repository'] = 'bareos' default['bareos']['description'] = 'Backup Archiving Recovery Open Sourced Current stable' end @@ -16,38 +16,75 @@ default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" when 'centos' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/repodata/repomd.xml.key" + case node['platform_version'].to_i + when '6' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/repodata/repomd.xml.key" + when '7' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_7/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_7/repodata/repomd.xml.key" + end +when 'fedora' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" when 'debian' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_7.0/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_7.0/Release.key" +else + default['bareos']['baseurl'] = nil + default['bareos']['gpgkey'] = nil end # Database -default['bareos']['database_type'] = 'postgresql' # postgresql/mysql -default['bareos']['dbdriver'] = 'postgresql' # postgresql/mysql -default['bareos']['dbname'] = 'bareos' -default['bareos']['dbuser'] = 'bareos' -default['bareos']['dbpassword'] = '' +default['bareos']['database']['catalog_name'] = 'MyCatalog' +default['bareos']['database']['database_type'] = 'postgresql' # postgresql/mysql +default['bareos']['database']['dbdriver'] = 'postgresql' # postgresql/mysql +default['bareos']['database']['dbname'] = 'bareos' +default['bareos']['database']['dbuser'] = 'bareos' +default['bareos']['database']['dbpassword'] = '' +# default['bareos']['database']['dbaddress'] = nil # Clients -default['bareos']['clients'] = %w() -default['bareos']['host_pools'] = '0' # Default is disabled, normal pools, see below -default['bareos']['default_pool'] = 'Default' -default['bareos']['full_pool'] = 'Full-Pool' -default['bareos']['incremental_pool'] = 'Inc-Pool' -default['bareos']['differential_pool'] = 'Diff-Pool' -default['bareos']['enable_vfulls'] = false # Needs more work within host template +default['bareos']['clients']['fd_port'] = 9102 +default['bareos']['clients']['max_concurrent_jobs'] = 20 +default['bareos']['clients']['client_list'] = {} # Hashes are generally better +default['bareos']['clients']['file_retention'] = '30 days' +default['bareos']['clients']['job_retention'] = '6 months' +default['bareos']['clients']['autoprune'] = 'no' +default['bareos']['clients']['heartbeat_interval'] = 600 +default['bareos']['clients']['jobdef_default_runlevel'] = 10 +default['bareos']['clients']['jobdef_default_storage'] = 'File' +default['bareos']['clients']['jobdef_default_messages'] = 'Standard' +default['bareos']['clients']['jobdef_default_fileset'] = 'Full Set' +default['bareos']['clients']['jobdef_default_schedule'] = 'WeeklyCycle' +default['bareos']['clients']['host_pools'] = '0' # Default is disabled, normal pools, see below +default['bareos']['clients']['default_pool'] = 'Default' +default['bareos']['clients']['full_pool'] = 'Full-Pool' +default['bareos']['clients']['incremental_pool'] = 'Inc-Pool' +default['bareos']['clients']['differential_pool'] = 'Diff-Pool' +default['bareos']['clients']['enable_vfulls'] = false # Needs more work within host template # Storage Daemon -default['bareos']['storage']['tape'] = false # tape may have to be handled via custom wrapper cookbooks -default['bareos']['storage']['server'] = node['hostname'] +default['bareos']['storage']['sd_port'] = 9103 +default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks +default['bareos']['storage']['servers'] = {} # Use FQDN of each server for consistancy in solo mode default['bareos']['storage']['custom_configs'] = '0' +default['bareos']['storage']['sd_mon_enable'] = 'yes' +default['bareos']['storage']['max_concurrent_jobs'] = 20 # Director -default['bareos']['dir_port'] = 9101 -default['bareos']['dir_max_concurrent_jobs'] = 20 +default['bareos']['director']['dir_port'] = 9101 +default['bareos']['director']['dir_max_concurrent_jobs'] = 20 +default['bareos']['director']['custom_configs'] = '1' +default['bareos']['director']['servers'] = {} # Use FQDN of each server for consistancy in solo mode # Subscription Management (Director) -default['bareos']['dir_subscription'] = nil -default['bareos']['dir_subs'] = nil +default['bareos']['director']['dir_subscription'] = nil +default['bareos']['director']['dir_subs'] = nil + +# Messages +default['bareos']['messages']['mail_to'] = "bareos@#{node['domain_name']}" +default['bareos']['messages']['default_messages'] = 'Standard' + +# Workstation +default['bareos']['workstation']['solo_mode'] = '0' From 05c2e11328e940096ed369426ca7875f28cef6ae Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 11:51:21 -0700 Subject: [PATCH 029/311] major version bump, users caution, much refactoring, apologies on that, adding fedora support --- metadata.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index c989191..c41da9e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,11 +4,11 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.2.0' +version '1.0.1' -supports 'debian', '~> 7.0' -supports 'ubuntu', '>= 12.04' -supports 'centos', '>= 6.0' +%w( centos fedora debian ubuntu ).each do |os| + supports os +end depends 'apt' depends 'openssl' From eb0d74ed4746322b67189af8bcbbd7b505b7cbb3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:20:33 -0700 Subject: [PATCH 030/311] adding exclusive call for openssl cookbook library, adding more variables based on recipe searches, declared dir versus server, comments --- recipes/client.rb | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/recipes/client.rb b/recipes/client.rb index fac9eec..9ce62f6 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -15,41 +15,44 @@ # 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. -# + +# Include the OpenSSL library for generating random passwords +::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) node.set_unless['bareos']['fd_password'] = random_password(length: 30, mode: :base64) node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] -# Installation du File daemon BAREOS - -package 'bareos-filedaemon' do - action :install -end +# Installation of the BAREOS File Daemon +package 'bareos-filedaemon' +# Determine the list of BAREOS directors if Chef::Config[:solo] - bareos_server = node['bareos']['server'] + bareos_dir = node['bareos']['director']['servers'] else - bareos_server = search(:node, 'role:bareos_server') + bareos_dir = search(:node, 'recipes:chef-bareos\:\:server') end +# Setup the configs for any local/remote File Daemons clients template '/etc/bareos/bareos-fd.conf' do source 'bareos-fd.conf.erb' owner 'root' group 'bareos' mode '0640' variables( - bareos_server: bareos_server + bareos_dir: bareos_dir ) - notifies :run, 'execute[restart-fd]', :immediately +notifies :run, 'execute[restart-fd]', :immediately end +# Allow the restart of the File Daemon with tests upfront, if called execute 'restart-fd' do command 'bareos-fd -t -c /etc/bareos/bareos-fd.conf' action :nothing notifies :restart, 'service[bareos-fd]', :delayed end +# Start and enable the BAREOS File Daemon service 'bareos-fd' do supports status: true, restart: true, reload: false action [:enable, :start] From 1db4a94bc8655f8698f45505b5715e019d394e9a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:21:45 -0700 Subject: [PATCH 031/311] cleanup, comments, refactoring some logic --- recipes/database.rb | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/recipes/database.rb b/recipes/database.rb index fcdeca9..137af5a 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -15,22 +15,21 @@ # 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. -# -package 'bareos-database-tools' do - action :install -end +# Include the repo recipe, should be ok in most cases +include_recipe 'chef-bareos::repo' + +# Install the BAREOS database tools package +package 'bareos-database-tools' -database = node['bareos']['database_type'] +# Define the type of database desired, mysql needs verified to be working +database = node['bareos']['database']['database_type'] +# Depending on what database is used, include things case database when 'postgresql' include_recipe 'postgresql::server' - - package "bareos-database-#{database}" do - action :install - end - + package "bareos-database-#{database}" else if platform_family?('rhel') database_client_name = database.to_s @@ -39,20 +38,12 @@ database_client_name = "#{database}-client" database_server_name = database.to_s end - - package database_client_name.to_s do - action :install - end - - package database_server_name.to_s do - action :install - end - - package "bareos-database-#{database}" do - action :install - end + package database_client_name.to_s + package database_server_name.to_s + package "bareos-database-#{database}" end +# Need to add some mysql logic here to do the database setup for bareos, psql only right now, mysql is manual if database == 'postgresql' execute 'create_database' do From 6331a342d37a1abdd45032e3637d68e1153beed0 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:23:20 -0700 Subject: [PATCH 032/311] moving openssl cookbook bit to other recipes as needed --- recipes/default.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/recipes/default.rb b/recipes/default.rb index 0ecb2ca..53f0723 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -15,10 +15,7 @@ # 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. -# - -# Randomly generate ssh passwords for Bareos Daemons -::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) +# Include both the repo and client recipes for most cases include_recipe 'chef-bareos::repo' include_recipe 'chef-bareos::client' From e28a9027923015226dec6c4d51c8c324629dae3d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:23:55 -0700 Subject: [PATCH 033/311] changing to case logic, adding fedora support --- recipes/repo.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/repo.rb b/recipes/repo.rb index 19483b9..945c1d4 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -15,19 +15,22 @@ # 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. -# -if platform_family?('rhel') +# Add repos for supported platform families, else give fatal error during chef run +case node['platform_family'] +when 'rhel', 'fedora' yum_repository node['bareos']['yum_repository'] do description node['bareos']['description'] baseurl node['bareos']['baseurl'] gpgkey node['bareos']['gpgkey'] action :create end -else +when 'debian' apt_repository 'bareos' do uri node['bareos']['baseurl'] components ['/'] key node['bareos']['gpgkey'] end +else + Chef::Log.fatal('System is not in the currently supported OS list') end From 7ad78f069a0445ccfd1ca7cc2b42d3453b86f6ab Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:25:15 -0700 Subject: [PATCH 034/311] refactoring, comments adding a file create for future conf files, etc --- recipes/server.rb | 113 +++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 61 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 0397688..c4aba16 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -16,7 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Preparing Random Password for the director and mon +# By default here including both the repo and client recipes +include_recipe 'chef-bareos' + +# Preparing Random Password for the director and mon, including OpenSSL library from client.rb node.set_unless['bareos']['dir_password'] = random_password(length: 30, mode: :base64) node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] @@ -28,97 +31,85 @@ end end -if Chef::Config[:solo] - bareos_clients = node['bareos']['clients'] -else - bareos_clients = search(:node, 'roles:bareos_client') +# Create hosts directory for host configs +directory '/etc/bareos/bareos-dir.d/clients/' do + owner 'root' + group 'root' + mode '0755' + action :create end -# Create hosts direcotry for host configs -directory '/etc/bareos/bareos-dir.d/clients/' do +# Create a placeholder file so BAREOS doesn't throw error when none found +file '/etc/bareos/bareos-dir.d/_recipe_complete.conf' do + content '# This is a base file so the recipe works with no additional help' owner 'root' group 'root' mode '0755' action :create end +# Create necessary bareos-dir config +template '/etc/bareos/bareos-dir.conf' do + source 'bareos-dir.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + db_driver: node['bareos']['database']['dbdriver'], + db_name: node['bareos']['database']['dbname'], + db_user: node['bareos']['database']['dbuser'], + db_password: node['bareos']['database']['dbpassword'], + db_address: node['bareos']['database']['dbaddress'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + # Handle seperate host config files # Populate host config files based on: -# * with values from the default['bareos']['clients'] attribute +# * the default['bareos']['clients']['client_list'] attribute # - OR - # * hosts with bareos_client role attached +if Chef::Config[:solo] + bareos_clients = node['bareos']['clients']['client_list'] +else + bareos_clients = search(:node, 'roles:bareos_client') +end + +# Account for any number of clients, setup the client config on the director machine +# Also push out whether to do custom client pools in chef-solo or chef-client mode bareos_clients.each do |client| - if Chef::Config[:solo] - template '/etc/bareos/bareos-dir.conf' do - source 'bareos-dir.conf.erb' - owner 'bareos' - group 'bareos' - mode '0640' - variables( - db_driver: node['bareos']['dbdriver'], - db_name: node['bareos']['dbname'], - db_user: node['bareos']['dbuser'], - db_password: node['bareos']['dbpassword'], - db_address: node['bareos']['dbaddress'], - client_full_pool: "#{client}-Full-Pool", - client_inc_pool: "#{client}-Inc-Pool", - client_diff_pool: "#{client}-Diff-Pool" - ) - notifies :run, 'execute[reload-dir]', :delayed - end - template "/etc/bareos/bareos-dir.d/clients/#{client}.conf" do - source 'client.conf.erb' - owner 'bareos' - group 'bareos' - mode '0640' + template "/etc/bareos/bareos-dir.d/clients/#{client}.conf" do + source 'client.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + if Chef::Config[:solo] variables( bareos_client: client, client_full_pool: "#{client}-Full-Pool", client_inc_pool: "#{client}-Inc-Pool", client_diff_pool: "#{client}-Diff-Pool" ) - notifies :run, 'execute[reload-dir]', :delayed - end - else - template '/etc/bareos/bareos-dir.conf' do - source 'bareos-dir.conf.erb' - owner 'bareos' - group 'bareos' - mode '0640' - variables( - db_driver: node['bareos']['dbdriver'], - db_name: node['bareos']['dbname'], - db_user: node['bareos']['dbuser'], - db_password: node['bareos']['dbpassword'], - db_address: node['bareos']['dbaddress'], - client_full_pool: "#{client['hostname']}-Full-Pool", - client_inc_pool: "#{client['hostname']}-Inc-Pool", - client_diff_pool: "#{client['hostname']}-Diff-Pool" - ) - notifies :run, 'execute[reload-dir]', :delayed - end - template "/etc/bareos/bareos-dir.d/clients/#{client['hostname']}.conf" do - source 'client.conf.erb' - owner 'bareos' - group 'bareos' - mode '0640' + else variables( - bareos_client: client['hostname'], - client_full_pool: "#{client['hostname']}-Full-Pool", - client_inc_pool: "#{client['hostname']}-Inc-Pool", - client_diff_pool: "#{client['hostname']}-Diff-Pool" + bareos_client: client['fqdn'], + client_full_pool: "#{client['fqdn']}-Full-Pool", + client_inc_pool: "#{client['fqdn']}-Inc-Pool", + client_diff_pool: "#{client['fqdn']}-Diff-Pool" ) - notifies :run, 'execute[reload-dir]', :delayed end + notifies :run, 'execute[reload-dir]', :delayed end end +# Allow a restart of the director daemon if called with tests up front execute 'reload-dir' do command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' action :nothing notifies :restart, 'service[bareos-dir]', :delayed end +# Enable and start the bareos-dir service service 'bareos-dir' do supports status: true, restart: true, reload: false action [:enable, :start] From bcb31729df11af0db34f20d9d9d7918423ead663 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:26:33 -0700 Subject: [PATCH 035/311] adding onl_if condition proper, split out sd and dir, comments, openssl bit inclusion --- recipes/storage.rb | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/recipes/storage.rb b/recipes/storage.rb index 64ea634..9184481 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -16,6 +16,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Include the OpenSSL library by itself so it isn't dependant on the client recipe +::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) + +# Include the repo recipe by default here, should be ok under most circumstances +include_recipe 'chef-bareos::repo' + # Setup Storage Daemon Random Passwords node.set_unless['bareos']['sd_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] @@ -25,43 +31,53 @@ action :install end +# Need more work on any Tape Integration # if node['bareos']['storage']['tape'] == 'true' # package "bareos-storage-tape" do # action :install # end # end +# Define both the bareos-sd and bareos-dir lists based on run_list searches if Chef::Config[:solo] - bareos_server = node['bareos']['server'] + bareos_sd = node['bareos']['storage']['servers'] + bareos_dir = node['bareos']['director']['servers'] else - bareos_server = search(:node, 'role:bareos_server') + bareos_sd = search(:node, 'recipes:chef-bareos\:\:storage') + bareos_dir = search(:node, 'recipes:chef-bareos\:\:server') end +# Setup the bareos-sd config template '/etc/bareos/bareos-sd.conf' do source 'bareos-sd.conf.erb' mode 0640 owner 'bareos' group 'bareos' variables( - bareos_server: bareos_server + bareos_sd: bareos_sd, + bareos_dir: bareos_dir ) notifies :run, 'execute[restart-sd]', :delayed end +# Create the custom config directory directory '/etc/bareos/bareos-sd.d' do owner 'root' group 'root' mode '0755' action :create notifies :run, 'execute[restart-sd]', :delayed + only_if node['bareos']['storage']['custom_configs'] == '1' end +# If called restart the bareos-sd confg(s) with a test first execute 'restart-sd' do command 'bareos-sd -t -c /etc/bareos/bareos-sd.conf' action :nothing notifies :restart, 'service[bareos-sd]', :immediately end +# Start and enable the bareos-sd service and run if called elsewhere service 'bareos-sd' do supports status: true, restart: true, reload: false action [:enable, :start] From 1eaa94fe0e91d9454cc6258bfbfc9681dde843af Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:27:07 -0700 Subject: [PATCH 036/311] adding some better logic to handle solo or client modes --- recipes/workstation.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/recipes/workstation.rb b/recipes/workstation.rb index a874a9b..b341bcc 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -15,15 +15,31 @@ # 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. -# +# Repo recipe is needed to install, so include by default, ok in most cases +include_recipe 'chef-bareos::repo' + +# Install bconsole from repo package 'bareos-bconsole' do action :install end +# Define the list of bareos directors +if Chef::Config[:solo] + bareos_dir = node['bareos']['director']['servers'] + node.default['bareos']['workstation']['solo_mode'] = '1' +else + bareos_dir = search(:node, 'roles:bareos_server') +end + +# Setup the bconsole config, pushes out list of bareos-dirs and if solo mode template '/etc/bareos/bconsole.conf' do source 'bconsole.conf.erb' mode 0640 owner 'bareos' group 'bareos' + variables( + bareos_dir: bareos_dir, + solo_mode: node['bareos']['workstation']['solo_mode'] + ) end From cb1fab253bb88eee763d9050571ad14115615c8f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:27:21 -0700 Subject: [PATCH 037/311] typos --- test/integration/roles/bareos_server.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/roles/bareos_server.json b/test/integration/roles/bareos_server.json index 68cff4e..10e337f 100644 --- a/test/integration/roles/bareos_server.json +++ b/test/integration/roles/bareos_server.json @@ -9,8 +9,8 @@ "chef_type": "role", "run_list": [ "role[bareos_client]", - "recipe[chef-bareos::server]", "recipe[chef-bareos::database]", + "recipe[chef-bareos::server]", "recipe[chef-bareos::storage]", "recipe[chef-bareos::workstation]" ], From 6b1a58d548d7a2a6667d921194fc2b8c7600be8f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:29:23 -0700 Subject: [PATCH 038/311] Refactoring, commits, using fqdn for solo compatibility, new tunables --- templates/default/bareos-dir.conf.erb | 120 ++++++++++++++++---------- 1 file changed, 76 insertions(+), 44 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 8f37d71..16a0a16 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -1,32 +1,43 @@ <%# DIRECTOR TEMPLATE %> -# Generated by Chef for <%= node['hostname'] %> +# Generated by Chef for <%= node['fqdn'] %> # Local modifications will be overwritten. +# +# Bareos Director Configuration File +####################### +# Director Definition # +####################### Director { - Name = <%= node['hostname'] %>-dir - DIRport = <%= node['bareos']['dir_port'] %> + Name = <%= node['fqdn'] %>-dir + DIRport = <%= node['bareos']['director']['dir_port'] %> QueryFile = "/usr/lib/bareos/scripts/query.sql" - Maximum Concurrent Jobs = <%= node['bareos']['dir_max_concurrent_jobs'] %> + Maximum Concurrent Jobs = <%= node['bareos']['director']['dir_max_concurrent_jobs'] %> Password = "<%= node['bareos']['dir_password'] %>" Messages = Daemon Heartbeat Interval = 600 - <% if node['bareos']['dir_subscription'] == true %> - Subscriptions = <%= node['bareos']['dir_subs'] %> + <% if node['bareos']['director']['dir_subscription'] == true %> + Subscriptions = <%= node['bareos']['dir_subs'] %> <% end %> } +###################### +# Catalog Backup Job # +###################### Job { - Name = "<%= node['hostname'] %>-BackupCatalog" - JobDefs = "<%= node['hostname'] %>-JobDef" + Name = "<%= node['fqdn'] %>-BackupCatalog" + JobDefs = "<%= node['fqdn'] %>-JobDef" Level = Full FileSet="Catalog" Schedule = "WeeklyCycleAfterBackup" - RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl MyCatalog" + RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl <%= node['bareos']['database']['catalog_name'] %>" RunAfterJob = "/usr/lib/bareos/scripts/delete_catalog_backup" Write Bootstrap = "|/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" Priority = 11 # run after main backup } +############ +# Filesets # +############ FileSet { Name = "Full Set" Include { @@ -47,24 +58,39 @@ FileSet { } } +# Example for windows machine filesets # +# FileSet { +# Name = "Windows All Drives" +# Enable VSS = yes +# Include { +# Options { +# Signature = MD5 +# Drive Type = fixed +# IgnoreCase = yes +# WildFile = "[A-Z]:/pagefile.sys" +# WildDir = "[A-Z]:/RECYCLER" +# WildDir = "[A-Z]:/$RECYCLE.BIN" +# WildDir = "[A-Z]:/System Volume Information" +# Exclude = yes +# } +# File = / +# } +# } + FileSet { - Name = "Windows All Drives" - Enable VSS = yes + Name = "Catalog" Include { Options { - Signature = MD5 - Drive Type = fixed - IgnoreCase = yes - WildFile = "[A-Z]:/pagefile.sys" - WildDir = "[A-Z]:/RECYCLER" - WildDir = "[A-Z]:/$RECYCLE.BIN" - WildDir = "[A-Z]:/System Volume Information" - Exclude = yes + signature = MD5 } - File = / + File = "/var/lib/bareos/bareos.sql" # database dump + File = "/etc/bareos" # configuration } } +############# +# Schedules # +############# Schedule { Name = "WeeklyCycle" Run = Full 1st sun at 23:05 @@ -77,17 +103,9 @@ Schedule { Run = Full sun-sat at 23:10 } -FileSet { - Name = "Catalog" - Include { - Options { - signature = MD5 - } - File = "/var/lib/bareos/bareos.sql" # database dump - File = "/etc/bareos" # configuration - } -} - +############ +# Storages # +############ Storage { Name = File Address = <%= node['fqdn'] %> # N.B. Use a fully qualified name here @@ -96,8 +114,11 @@ Storage { Media Type = File } +############ +# Catalogs # +############ Catalog { - Name = MyCatalog + Name = <%= node['bareos']['database']['catalog_name'] %> dbdriver = "<%= @db_driver %>" dbname = "<%= @db_name %>" dbuser = "<%= @db_user %>" @@ -107,18 +128,21 @@ Catalog { <% end %> } +#################### +# Console/Messages # +#################### Console { - Name = backup-mon + Name = <%= node['fqdn'] %>-mon Password = "<%= node['bareos']['mon_password'] %>" CommandACL = status, .status } Messages { Name = Standard - mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: %t %e of %c %l\" %r" - operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos: Intervention needed for %j\" %r" - mail = root@localhost = all, !skipped - operator = root@localhost = mount + mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos: %t %e of %c %l\" %r" + operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos: Intervention needed for %j\" %r" + mail = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped + operator = <%= node['bareos']['messages']['mail_to'] %> = mount console = all, !skipped, !saved append = "/var/log/bareos/bareos.log" = all, !skipped catalog = all @@ -126,12 +150,15 @@ Messages { Messages { Name = Daemon - mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<%r\>\" -s \"Bareos daemon message\" %r" - mail = root@localhost = all, !skipped + mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos daemon message\" %r" + mail = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped console = all, !skipped, !saved append = "/var/log/bareos/bareos.log" = all, !skipped } +################# +# Default Pools # +################# Pool { Name = Default Pool Type = Backup @@ -178,10 +205,15 @@ Pool { Name = Scratch Pool Type = Backup } +<% if node['bareos']['director']['custom_configs'] == '1' %> -######################################### -# Custom Director Daemon Config Locations -######################################### +########################################### +# Custom Director Daemon Config Locations # +########################################### -# Custom Client Configs -@|"sh -c 'for f in /etc/bareos/bareos-dir.d/clients/*.conf ; do echo @${f} ; done'" +# General +@|"sh -c 'for conf in /etc/bareos/bareos-dir.d/*.conf ; do echo @${conf} ; done'" + +# Clients +@|"sh -c 'for clients in /etc/bareos/bareos-dir.d/clients/*.conf ; do echo @${clients} ; done'" +<% end %> From 660d834be9ad07aa1b2fea7b94e244086ac82fd4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:30:06 -0700 Subject: [PATCH 039/311] back to fqdn for solo compat, comments, new tunables --- templates/default/bareos-fd.conf.erb | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index a984e37..b08de61 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -1,28 +1,33 @@ <%# FILE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['hostname'] %> +# Generated by Chef for <%= node['fqdn'] %> # Local modifications will be overwritten. +# +# Bareos Client FileDaemon Configuration File FileDaemon { - Name = <%= node['hostname'] %>-fd - Maximum Concurrent Jobs = 20 + Name = <%= node['fqdn'] %>-fd + FDPort = <%= node['bareos']['clients']['fd_port'] %> + Maximum Concurrent Jobs = <%= node['bareos']['clients']['max_concurrent_jobs'] %> + Heartbeat Interval = <%= node['bareos']['clients']['heartbeat_interval'] %> } -<% @bareos_server.each do |server| %> - +<% @bareos_dir.each do |director| %> +########## +# Director/Monitor Resources for <%= director['fqdn'] %> # +########## Director { - Name = <%= server['hostname'] %>-dir + Name = <%= director['fqdn'] %>-dir Password = "<%= node['bareos']['fd_password'] %>" } Director { - Name = <%= server['hostname'] %>-mon - Password = "<%= node['bareos']['mon_password'] %>" - Monitor = yes + Name = <%= director['fqdn'] %>-mon + Password = "<%= director['bareos']['mon_password'] %>" + Monitor = <%= node['bareos']['storage']['sd_mon_enable'] %> } Messages { - Name = Standard - director = backup-dir = all, !skipped, !restored + Name = <%= node['bareos']['messages']['default_messages'] %> + director = <% director %>-dir = all } - <% end %> From 5d373369911aa89a07f11f22aad13e8e48da5f6a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:30:24 -0700 Subject: [PATCH 040/311] back to fqdn for solo compat, comments, new tunables --- templates/default/bareos-sd.conf.erb | 36 +++++++++++++++++----------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 653b240..611249f 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -1,23 +1,36 @@ <%# STORAGE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['hostname'] %> +# Generated by Chef for <%= node['fqdn'] %> # Local modifications will be overwritten. +# +# Bareos Storage Daemon Configuration File# Storage { - Name = <%= node['hostname'] %>-sd - Maximum Concurrent Jobs = 20 + Name = <%= node['fqdn'] %>-sd + SDPort = <%= node['bareos']['storage']['sd_port'] %> + Maximum Concurrent Jobs = <%= node['bareos']['storage']['max_concurrent_jobs'] %> } +<% @bareos_dir.each do |director| %> +########## +# Director/Monitor Resources for <%= director %> # +########## Director { - Name = <%= node['hostname'] %>-dir + Name = <%= director['fqdn'] %>-dir Password = "<%= node['bareos']['sd_password'] %>" } -<% @bareos_server.each do |server| %> Director { - Name = <%= server['hostname'] %>-mon - Password = "<%= server['bareos']['mon_password'] %>" - Monitor = yes + Name = <%= director['fqdn'] %>-mon + Password = "<%= director['bareos']['mon_password'] %>" + Monitor = <%= node['bareos']['storage']['sd_mon_enable'] %> } + +Messages { + Name = <%= node['bareos']['messages']['default_messages'] %> + director = <%= director['fqdn'] %>-dir = all +} +########## + <% end %> Device { @@ -30,13 +43,8 @@ Device { RemovableMedia = no; AlwaysOpen = no; } - -Messages { - Name = Standard - director = backup-dir = all -} - <% if node['bareos']['storage']['custom_configs'] == '1' %> + ######################################## # Custom Storage Daemon Config Locations ######################################## From 4b336424fdd258497bbf4be9679e12f3cd338ce3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:30:53 -0700 Subject: [PATCH 041/311] back to fqdn for solo compat, comments, new tunables --- templates/default/bconsole.conf.erb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index 9e7c184..515c7c5 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -1,10 +1,26 @@ +<%# BCONSOLE TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %> +# Local modifications will be overwritten. # # Bareos User Agent (or Console) Configuration File -# +<% if @solo_mode == '1' %> + <% @bareos_dir.each do |director| %> +Director { + Name = <%= director %>-dir + DIRport = <%= node['bareos']['director']['dir_port'] %> + address = <%= director %> + Password = "<%= node['bareos']['dir_password'] %>" +} + <% end %> +<% else %> + <%# @bareos_dir_hostname.zip(@bareos_dir_fqdn).each do |hostname, fqdn| %> + <% @bareos_dir.each do |director| %> Director { - Name = "<%= node['hostname'] %>-dir" - DIRport = 9101 - address = "<%= node['hostname'] %>" + Name = <%= director['fqdn'] %>-dir + DIRport = <%= node['bareos']['director']['dir_port'] %> + address = <%= director['fqdn'] %> Password = "<%= node['bareos']['dir_password'] %>" } + <% end %> +<% end %> From ed8b78130f134fcb5178800958c538607ef66604 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:31:38 -0700 Subject: [PATCH 042/311] back to fqdn for solo compat, comments, new tunables --- templates/default/client.conf.erb | 53 +++++++++++++++++-------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 7a9178e..9fadd8e 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -1,14 +1,19 @@ -<%# HOST TEMPLATE %> +<%# BAREOS CLIENT TEMPLATE %> +# Generated by Chef for <%= @bareos_client %>-fd # Local modifications will be overwritten. -# Bareos Host Config for <%= @bareos_client %>-fd +# +# Bareos Client Configuration File Client { Name = <%= @bareos_client %>-fd Address = <%= @bareos_client %> + FDPort = <%= node['bareos']['clients']['fd_port'] %> + Catalog = <%= node['bareos']['database']['catalog_name'] %> Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon - File Retention = 30 days - Job Retention = 6 months - AutoPrune = no + File Retention = <%= node['bareos']['clients']['file_retention'] %> + Job Retention = <%= node['bareos']['clients']['job_retention'] %> + AutoPrune = <%= node['bareos']['clients']['autoprune'] %> + Maximum Concurrent Jobs = <%= node['bareos']['clients']['max_concurrent_jobs'] %> } JobDefs { @@ -16,26 +21,26 @@ JobDefs { Type = Backup Level = Incremental Client = <%= @bareos_client %>-fd - FileSet = "Full Set" - Schedule = "WeeklyCycle" - Storage = File - Messages = Standard - Pool = <%= node['bareos']['default_pool'] %> + FileSet = "<%= node['bareos']['clients']['jobdef_default_fileset'] %>" + Schedule = "<%= node['bareos']['clients']['jobdef_default_schedule'] %>" + Storage = <%= node['bareos']['clients']['jobdef_default_storage'] %> + Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> + Pool = <%= node['bareos']['clients']['default_pool'] %> # Each client can have its own Pool to help with certain cases -<% if node['bareos']['host_pools'] == '1' %> +<% if node['bareos']['clients']['host_pools'] == '1' %> FullBackupPool = <%= @client_full_pool %> IncrementalBackupPool = <%= @client_inc_pool %> DifferentialBackupPool = <%= @client_diff_pool %> -<% elsif node['bareos']['host_pools'] == '0' %> - FullBackupPool = <%= node['bareos']['full_pool'] %> - IncrementalBackupPool = <%= node['bareos']['incremental_pool'] %> - DifferentialBackupPool = <%= node['bareos']['differential_pool'] %> +<% elsif node['bareos']['clients']['host_pools'] == '0' %> + FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> + IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> <% else %> - # FullBackupPool = <%= node['bareos']['full_pool'] %> - # IncrementalBackupPool = <%= node['bareos']['incremental_pool'] %> - # DifferentialBackupPool = <%= node['bareos']['differential_pool'] %> + # FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> + # IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> + # DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> <% end %> - Priority = 10 + Priority = <%= node['bareos']['clients']['jobdef_default_runlevel'] %> Write Bootstrap = "/var/lib/bareos/%c.bsr" } @@ -52,23 +57,23 @@ Job { Client = <%= @bareos_client %>-fd FileSet= "Full Set" Storage = File -<% if node['bareos']['host_pools'] == '1' %> +<% if node['bareos']['clients']['host_pools'] == '1' %> Pool = <%= @client_full_pool %> <% else %> - Pool = <%= node['bareos']['full_pool'] %> + Pool = <%= node['bareos']['clients']['full_pool'] %> <% end %> Messages = Standard Where = /tmp/<%= @bareos_client %>_restored/ } +<% if node['bareos']['clients']['enable_vfulls'] == '1' %> -<% if node['bareos']['enable_vfulls'] == '1' %> # VirtualFull Job <%# Need some logic here to determine whether to use %> <%# VirtualFull backups or not %> <% end %> +<% if node['bareos']['clients']['host_pools'] == '1' %> -<% if node['bareos']['host_pools'] == '1' %> -# Individual host pools for better storage utilization +# Individual host pools for better tape library/storage utilization Pool { Name = <%= @client_full_pool %> Pool Type = Backup From 147029e63637c97ce88f60777fd11059d6f64a9c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 12:42:42 -0700 Subject: [PATCH 043/311] indent typo --- recipes/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/client.rb b/recipes/client.rb index 9ce62f6..49bd8a9 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -42,7 +42,7 @@ variables( bareos_dir: bareos_dir ) -notifies :run, 'execute[restart-fd]', :immediately + notifies :run, 'execute[restart-fd]', :immediately end # Allow the restart of the File Daemon with tests upfront, if called From 8e5ba4f02048b340a19141c58497f372e64f8153 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 15:07:50 -0700 Subject: [PATCH 044/311] Fixing Documentation with new bits, need some more detail over time --- README.md | 110 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 7e71a6c..f043a49 100644 --- a/README.md +++ b/README.md @@ -11,57 +11,93 @@ This cookbook has been tested with RHEL, Debian, Ubuntu systems. It should work # Attributes -## Database - -Attribute | Description |Type | Default ------------------|-------------|-----|-------- -["bareos"]["database_type"] | Specify the database type | string | 'postgresql' -["bareos"]["dbdriver"] | Specify the database driver | string | 'postgresql' -["bareos"]["dbname"] | Specify the database default name | string | 'bareos' -["bareos"]["dbuser"] | Specify the db user name | string | 'bareos' -["bareos"]["dbpassword"] | Specify the db password | string | '' -["bareos"]["dbaddress"] | Specify the db address | string | nil - -## General +## Repository -Attribute | Description |Type | Default ------------------|-------------|-----|-------- +Attribute | Description | Type | Default +-----------------|-------------|------|--------- ['bareos']['url'] | Base URL for Bareos Repository | string | 'http://download.bareos.org/bareos/release' ['bareos']['version'] | Software Version | string | '14.2' +OS Family | Attribute | Default +--------------|-----------|--------- +rhel/fedora |['bareos']['yum_repository'] | 'bareos' +rhel/fedora |['bareos']['description'] | 'Description of repo string' +varies | ['bareos']['baseurl'] | See attributes file +varies | ['bareos']['gpgkey'] | See attributes file + +## Database + +Attribute | Description | Type | Default +-----------------|-------------|------|--------- +['bareos']['database']['catalog_name'] | Catalog Name | string | 'MyCatalog' +['bareos']['database']['database_type'] | Database type | string | 'postgresql' +['bareos']['database']['dbdriver'] | Database driver | string | 'postgresql' +['bareos']['database']['dbname'] | Database default name | string | 'bareos' +['bareos']['database']['dbuser'] | Database user name | string | 'bareos' +['bareos']['database']['dbpassword'] | Database password | string | '' +['bareos']['database']['dbaddress'] | Database address | string | nil + +## Clients + +Attribute | Description | Type | Default +-----------------|-------------|------|--------- +['bareos']['clients']['fd_port'] | | | 9102 +['bareos']['clients']['max_concurrent_jobs'] | | | 20 +['bareos']['clients']['client_list'] | | | {} +['bareos']['clients']['file_retention'] | | | '30 days' +['bareos']['clients']['job_retention'] | | | '6 months' +['bareos']['clients']['autoprune'] | | | 'no' +['bareos']['clients']['heartbeat_interval'] | | | 600 +['bareos']['clients']['jobdef_default_runlevel'] | | | 10 +['bareos']['clients']['jobdef_default_storage'] | | | 'File' +['bareos']['clients']['jobdef_default_messages'] | | | 'Standard' +['bareos']['clients']['jobdef_default_fileset'] | | | 'Full Set' +['bareos']['clients']['jobdef_default_schedule'] | | | 'WeeklyCycle' +['bareos']['clients']['host_pools'] | | | '0' +['bareos']['clients']['default_pool'] | | | 'Default' +['bareos']['clients']['full_pool'] | | | 'Full-Pool' +['bareos']['clients']['incremental_pool'] | | | 'Inc-Pool' +['bareos']['clients']['differential_pool'] | | | 'Diff-Pool' +['bareos']['clients']['enable_vfulls'] | | | false + ## Storage Daemon -Attribute | Description |Type | Default ------------------|-------------|-----|-------- -['bareos']['tape'] | Enable Tape Features | boolean | false -['bareos']['storage']['server'] | Define name of SD server | string | node['hostname'] -['bareos']['storage']['custom_configs'] | Allows custom SD configs via wrapper | string | '0' - -## Clients/Hosts - -Attribute | Description |Type | Default ------------------|-------------|-----|-------- -['bareos']['clients'] | Monitor Clients (Solo Mode only right now) | array | %w() -['bareos']['host_pools'] | Seperate Host Pools | string | '0' -['bareos']['default_pool'] | Basic Default Pool | string | 'Default' -['bareos']['full_pool'] | Basic Full Pool | string | 'Full-Pool' -['bareos']['incremental_pool'] | Basic Incremental Pool | string | 'Inc-Pool' -['bareos']['differential_pool'] | Basic Differential Pool | string | 'Diff-Pool' -['bareos']['enable_vfulls'] | Activate basic Virtual Full Backups (Not currently used, on radar though) | boolean | false +Attribute | Description | Type | Default +-----------------|-------------|------|--------- + +['bareos']['storage']['sd_port'] | | | 9103 +['bareos']['storage']['tape'] | | | false +['bareos']['storage']['servers'] | | | {} +['bareos']['storage']['custom_configs'] | | | '0' +['bareos']['storage']['sd_mon_enable'] | | | 'yes' +['bareos']['storage']['max_concurrent_jobs'] | | | 20 ## Director -Attribute | Description |Type | Default ------------------|-------------|-----|-------- -['bareos']['dir_port'] | Network Port for Director | number | 9101 -['bareos']['dir_max_concurrent_jobs'] | Max concurrent jobs for director | number | 20 +Attribute | Description | Type | Default +-----------------|-------------|------|--------- +['bareos']['director']['dir_port'] | | | 9101 +['bareos']['director']['dir_max_concurrent_jobs'] | | | 20 +['bareos']['director']['custom_configs'] | | | '1' +['bareos']['director']['servers'] | | | {} ## Subscription Management (Director) -Attribute | Description |Type | Default ------------------|-------------|-----|-------- +Attribute | Description | Type | Default +-----------------|-------------|------|--------- ['bareos']['dir_subscription'] | Support Subscription Status | boolean | nil/False ['bareos']['dir_subs'] | Subscription Level/Count | number | nil +## Messages +Attribute | Description | Type | Default +-----------------|-------------|------|--------- +['bareos']['messages']['mail_to'] | | | "bareos@#{node['domain_name']}" +['bareos']['messages']['default_messages'] | | | 'Standard' + +## Workstation +Attribute | Description | Type | Default +-----------------|-------------|------|--------- +['bareos']['workstation']['solo_mode'] | | | '0' + # Basic Usage ## Roles From ff288fa03a1b3ad44db37661fdf9819ebb8aa458 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 15:10:41 -0700 Subject: [PATCH 045/311] Format Typo --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index f043a49..799c996 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,6 @@ Attribute | Description | Type | Default ['bareos']['storage']['max_concurrent_jobs'] | | | 20 ## Director - Attribute | Description | Type | Default -----------------|-------------|------|--------- ['bareos']['director']['dir_port'] | | | 9101 From a1d726c6843348c7ec142fd151c373f300fbbecd Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 15:12:28 -0700 Subject: [PATCH 046/311] Format Typo --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 799c996..50e9b5d 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ Attribute | Description | Type | Default ['bareos']['clients']['enable_vfulls'] | | | false ## Storage Daemon + Attribute | Description | Type | Default -----------------|-------------|------|--------- - ['bareos']['storage']['sd_port'] | | | 9103 ['bareos']['storage']['tape'] | | | false ['bareos']['storage']['servers'] | | | {} @@ -72,6 +72,7 @@ Attribute | Description | Type | Default ['bareos']['storage']['max_concurrent_jobs'] | | | 20 ## Director + Attribute | Description | Type | Default -----------------|-------------|------|--------- ['bareos']['director']['dir_port'] | | | 9101 @@ -87,12 +88,14 @@ Attribute | Description | Type | Default ['bareos']['dir_subs'] | Subscription Level/Count | number | nil ## Messages + Attribute | Description | Type | Default -----------------|-------------|------|--------- ['bareos']['messages']['mail_to'] | | | "bareos@#{node['domain_name']}" ['bareos']['messages']['default_messages'] | | | 'Standard' ## Workstation + Attribute | Description | Type | Default -----------------|-------------|------|--------- ['bareos']['workstation']['solo_mode'] | | | '0' From ba29d12d6c1c344b7d333c20f203a801168d8bb1 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 15:16:13 -0700 Subject: [PATCH 047/311] minor updates --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 50e9b5d..fd07b99 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ Chef-Bareos Cookbook [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) -This cookbook installs and configures backups based on [Bareos](https://www.bareos.org/en/). +This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). # Requirements -This cookbook has been tested with RHEL, Debian, Ubuntu systems. It should work with Chef 11 and Chef 12 configurations, if not please file a bug report and it will be addressed. The chef-bareos cookbook is still undergoing some feature additions so it is recommended to watch for changes to the README. +This cookbook has been tested with CentOS, Fedora, Debian, Ubuntu systems. It should work with Chef 11 and Chef 12 configurations, if not please file a bug report and it will be addressed. The chef-bareos cookbook is still undergoing some feature additions so it is recommended to watch for changes to the README. # Attributes From af9a2f13cda5723ea296ca4b38a55f1a13d1b9f4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 23 Sep 2015 23:08:58 -0700 Subject: [PATCH 048/311] aligning with documentation for bareos just in case --- templates/default/bareos-sd.conf.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 611249f..65adec2 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -33,15 +33,15 @@ Messages { <% end %> -Device { - Name = FileStorage - Media Type = File +Device { + Name = FileStorage + Media Type = File Archive Device = /var/lib/bareos/storage - LabelMedia = yes; - Random Access = Yes; - AutomaticMount = yes; - RemovableMedia = no; - AlwaysOpen = no; + Random Access = Yes; + AutomaticMount = yes; + RemovableMedia = no; + AlwaysOpen = no; + LabelMedia = yes } <% if node['bareos']['storage']['custom_configs'] == '1' %> From 385b0ab43cd7b4b6dbba5c33284194184d481c19 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 24 Sep 2015 00:30:50 -0700 Subject: [PATCH 049/311] aligning with docs --- templates/default/bareos-dir.conf.erb | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 16a0a16..8c10a4a 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -159,12 +159,27 @@ Messages { ################# # Default Pools # ################# + +# Pool { +# Name = File +# Pool Type = Backup +# Recycle = yes +# AutoPrune = yes +# Volume Retention = 1 year +# Maximum Volume Bytes = 10G +# Maximum Volumes = 100 +# LabelFormat = "FileVol-" +# } + Pool { Name = Default Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 30 days + Maximum Volume Bytes = 10G + Maximum Volumes = 100 + LabelFormat = "DefaultVol-" } Pool { @@ -173,6 +188,9 @@ Pool { Recycle = yes AutoPrune = yes Volume Retention = 6 months + Maximum Volume Bytes = 10G + Maximum Volumes = 100 + LabelFormat = "Full-" } Pool { @@ -181,6 +199,9 @@ Pool { Recycle = yes AutoPrune = yes Volume Retention = 2 months + Maximum Volume Bytes = 10G + Maximum Volumes = 100 + LabelFormat = "Inc-" } Pool { @@ -189,16 +210,9 @@ Pool { Recycle = yes AutoPrune = yes Volume Retention = 4 months -} - -Pool { - Name = File - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 1 year - Maximum Volume Bytes = 50G + Maximum Volume Bytes = 10G Maximum Volumes = 100 + LabelFormat = "Diff-" } Pool { From 714d7ce977f93b84a2c2446255e2ff38425ba3cc Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 24 Sep 2015 00:31:16 -0700 Subject: [PATCH 050/311] aligning with docs --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c41da9e..c5647ad 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.1' +version '1.0.2' %w( centos fedora debian ubuntu ).each do |os| supports os From 579e8a9a0260e0c0f7dea28a0e21f51a3d1d96f8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 24 Sep 2015 00:57:26 -0700 Subject: [PATCH 051/311] reworking where defining variables --- recipes/server.rb | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index c4aba16..57e6d06 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -78,26 +78,24 @@ # Account for any number of clients, setup the client config on the director machine # Also push out whether to do custom client pools in chef-solo or chef-client mode bareos_clients.each do |client| - template "/etc/bareos/bareos-dir.d/clients/#{client}.conf" do + # Special logic to determine how to extract fqdn + if Chef::Config[:solo] + client_fqdn = client + else + client_fqdn = client['fqdn'] + end + + template "/etc/bareos/bareos-dir.d/clients/#{client_fqdn}.conf" do source 'client.conf.erb' owner 'bareos' group 'bareos' mode '0640' - if Chef::Config[:solo] - variables( - bareos_client: client, - client_full_pool: "#{client}-Full-Pool", - client_inc_pool: "#{client}-Inc-Pool", - client_diff_pool: "#{client}-Diff-Pool" - ) - else - variables( - bareos_client: client['fqdn'], - client_full_pool: "#{client['fqdn']}-Full-Pool", - client_inc_pool: "#{client['fqdn']}-Inc-Pool", - client_diff_pool: "#{client['fqdn']}-Diff-Pool" - ) - end + variables( + bareos_client: client_fqdn, + client_full_pool: "#{client_fqdn}-Full-Pool", + client_inc_pool: "#{client_fqdn}-Inc-Pool", + client_diff_pool: "#{client_fqdn}-Diff-Pool" + ) notifies :run, 'execute[reload-dir]', :delayed end end From 23ddf64c3c230f92d006d7ee503f641a9753dfd3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 24 Sep 2015 00:57:35 -0700 Subject: [PATCH 052/311] reworking where defining variables --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c5647ad..83febcd 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.2' +version '1.0.3' %w( centos fedora debian ubuntu ).each do |os| supports os From 9b5621d8df229f0d6bed80e109f58d5102117249 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 13:29:03 -0700 Subject: [PATCH 053/311] updated repo url logic --- attributes/default.rb | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 60a15f3..171ecf7 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -11,25 +11,22 @@ default['bareos']['description'] = 'Backup Archiving Recovery Open Sourced Current stable' end -case node['platform'] -when 'ubuntu' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" -when 'centos' - case node['platform_version'].to_i - when '6' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_6/repodata/repomd.xml.key" - when '7' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_7/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_7/repodata/repomd.xml.key" +case node['platform_family'] +when 'debian' + case node['platform'] + when 'debian' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version']}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version']}/Release.key" + when 'ubuntu' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" end +when 'rhel' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" when 'fedora' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" -when 'debian' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_7.0/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_7.0/Release.key" else default['bareos']['baseurl'] = nil default['bareos']['gpgkey'] = nil From 7cd164c13baf7de9e3abd146ca1899ca88169a5c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 13:29:37 -0700 Subject: [PATCH 054/311] updated supported versions of EL based systems --- metadata.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index c41da9e..7dc0ba0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,9 +4,13 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.1' +version '1.0.3' -%w( centos fedora debian ubuntu ).each do |os| +%w( centos redhat ).each do |os| + supports os, '>= 6.0' +end + +%w( fedora debian ubuntu ).each do |os| supports os end From c78975f079e54bed90305b981cdeb284c6cbba6e Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 13:30:08 -0700 Subject: [PATCH 055/311] updated list of changes, fixed upcoming version --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 105a628..e4c76a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Bareos Cookbook CHANGELOG This file is used to list changes made in each version of the bareos cookbook. -0.2.0 +1.0.3 ----- - Ian Smith @@ -17,6 +17,8 @@ This file is used to list changes made in each version of the bareos cookbook. - Minor fixes - Larger version bump for version clarity - Updated Docs + - Adding support for Fedora and RHEL 6/7 + - Reworked the available repos to some better logic 0.1.4 ----- From 8d13d5766c79fcb476599414f0868ae5efaa24e5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 13:34:07 -0700 Subject: [PATCH 056/311] Adding clear list of supported Operating Systems --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index fd07b99..3e5848b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,12 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare This cookbook has been tested with CentOS, Fedora, Debian, Ubuntu systems. It should work with Chef 11 and Chef 12 configurations, if not please file a bug report and it will be addressed. The chef-bareos cookbook is still undergoing some feature additions so it is recommended to watch for changes to the README. +# Supported Operating Systems: + * RHEL 6/7 + * Fedora 19/20 + * Debian 6/7 + * Ubuntu 12.04 and higher + # Attributes ## Repository From 116e88230c1cadc1e0b05b6b1a6021ffa3d49914 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 17:03:25 -0700 Subject: [PATCH 057/311] adding fedora 19 tests --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 0b00024..189734b 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -23,13 +23,13 @@ platforms: - name: centos-7.0 + - name: fedora-19 + - name: fedora-20 - name: fedora-21 -data_bags_path: test/integration/data_bags/ roles_path: test/integration/roles/ -environments_path: test/integration/environments suites: - name: aio-server From 4c204f5f28d37bf551a0261b9ee598188d2630db Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 17:09:07 -0700 Subject: [PATCH 058/311] rubocop cleanup --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 171ecf7..8894fd6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -22,8 +22,8 @@ default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" end when 'rhel' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" when 'fedora' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" From 26ecf3498d6c1b335e36fa63a691293162438464 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 17:17:27 -0700 Subject: [PATCH 059/311] updating some more README bits --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e5848b..abba7d1 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,16 @@ Chef-Bareos Cookbook [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). +[Official BAREOS Documentation](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). # Requirements +The chef-bareos cookbook is still undergoing some extensive feature additions so it is recommended to watch for changes to the README/CHANGELOG and version lock any dependancies in your wrapper cookbook metadata file. Testing of new versions is highly recommended until we can say we have a majority of the sane defaults configured. Progress is being made but it is taking time. -This cookbook has been tested with CentOS, Fedora, Debian, Ubuntu systems. It should work with Chef 11 and Chef 12 configurations, if not please file a bug report and it will be addressed. The chef-bareos cookbook is still undergoing some feature additions so it is recommended to watch for changes to the README. +## Supported Chef Versions: + * Chef 11 + * Chef 12 -# Supported Operating Systems: +## Supported Operating Systems: * RHEL 6/7 * Fedora 19/20 * Debian 6/7 From c2fee5cd703c9a82f2ada04be67f79799e79fdeb Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 17:18:10 -0700 Subject: [PATCH 060/311] needed at least one return here --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index abba7d1..c928079 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Chef-Bareos Cookbook [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). + [Official BAREOS Documentation](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). # Requirements From 45bfefcc49ad8972af6d6263c8b88dab56bbfbe2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Sep 2015 17:21:44 -0700 Subject: [PATCH 061/311] adding projected documentation about the recipes soon, placing some skeloton bits --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c928079..05cbb2b 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,14 @@ You'll need to run chef-client on the backup server every time you add a new nod Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of clients. +## Recipes (More detail coming) + * client + * database + * default + * repo + * server + * storage + * workstation # Contributing From 2991b162224c8100b95c2de6e9597111e7583bea Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 29 Sep 2015 01:10:17 -0700 Subject: [PATCH 062/311] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05cbb2b..a27d385 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare [Official BAREOS Documentation](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). # Requirements -The chef-bareos cookbook is still undergoing some extensive feature additions so it is recommended to watch for changes to the README/CHANGELOG and version lock any dependancies in your wrapper cookbook metadata file. Testing of new versions is highly recommended until we can say we have a majority of the sane defaults configured. Progress is being made but it is taking time. +The chef-bareos cookbook is still undergoing some extensive feature additions so it is recommended to watch for changes to the README/CHANGELOG and version lock any dependencies in your wrapper cookbook metadata file. Testing of new versions is highly recommended until we can say we have a majority of the sane defaults configured. Progress is being made but it is taking time. ## Supported Chef Versions: * Chef 11 From d05fdb8a67672bc67f3a3d9a1d4e9a06efedac84 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:10:39 -0700 Subject: [PATCH 063/311] Ugh, wish this was all lowercase...oh well --- attributes/default.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8894fd6..d61f581 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -22,8 +22,14 @@ default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" end when 'rhel' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + case node['platform'] + when 'centos' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + when 'redhat' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + end when 'fedora' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" From 3992ff8013ceb6639f9db456266ace91bc50ce29 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:11:33 -0700 Subject: [PATCH 064/311] fixing some repo logic...sigh --- CHANGELOG.md | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4c76a0..0b6fecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ Bareos Cookbook CHANGELOG This file is used to list changes made in each version of the bareos cookbook. -1.0.3 +1.0.4 ----- - Ian Smith diff --git a/metadata.rb b/metadata.rb index 7dc0ba0..eafbc70 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.3' +version '1.0.4' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 65943223b3b1d9c279e183799496a0c5db319a43 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:16:14 -0700 Subject: [PATCH 065/311] fixing some repo logic...sigh --- attributes/default.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index d61f581..e1e8965 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -24,11 +24,11 @@ when 'rhel' case node['platform'] when 'centos' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" when 'redhat' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" end when 'fedora' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" From 7e07be8fe2b1ece14056c259d954cccde910ab21 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:18:01 -0700 Subject: [PATCH 066/311] bump again for berks --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index eafbc70..ba82533 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.4' +version '1.0.5' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 0ee3cfffb68fcad6b316ba0a18b962170d672d85 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:27:31 -0700 Subject: [PATCH 067/311] missed this --- templates/default/bareos-fd.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index b08de61..9783b40 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -28,6 +28,6 @@ Director { Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <% director %>-dir = all + director = <% director['fqdn'] %>-dir = all } <% end %> From 8b8f64d197cca93c63d1f59f54df3de67f440a91 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:36:42 -0700 Subject: [PATCH 068/311] typo fix --- templates/default/bareos-fd.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index 9783b40..8f60a29 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -28,6 +28,6 @@ Director { Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <% director['fqdn'] %>-dir = all + director = <%= director['fqdn'] %>-dir = all } <% end %> From b1287c9afd81a9001b201b13c3b5aee22c38c0f7 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:37:59 -0700 Subject: [PATCH 069/311] moving to el71 testing --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 189734b..a42e286 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -21,7 +21,7 @@ platforms: - name: centos-6.7 - - name: centos-7.0 + - name: centos-7.1 - name: fedora-19 From cd1893358d13e4e3dde8ac570dca4a7fa9e9bdfe Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 16:52:07 -0700 Subject: [PATCH 070/311] ordering issue in the role --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a27d385..a73df6b 100644 --- a/README.md +++ b/README.md @@ -154,8 +154,8 @@ For the primary server, if not splitting out services, you need a role named ``b "chef_type": "role", "run_list": [ "role[bareos_client]", - "recipe[chef-bareos::server]", "recipe[chef-bareos::database]", + "recipe[chef-bareos::server]", "recipe[chef-bareos::storage]", "recipe[chef-bareos::workstation]" ], From 17feca4255b07f6d637daf0a9818e4aa45d66c04 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:29:56 -0700 Subject: [PATCH 071/311] redesigned roles to better suit searching and wrappers --- .../roles/{bareos_server.json => bareos_director.json} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename test/integration/roles/{bareos_server.json => bareos_director.json} (74%) diff --git a/test/integration/roles/bareos_server.json b/test/integration/roles/bareos_director.json similarity index 74% rename from test/integration/roles/bareos_server.json rename to test/integration/roles/bareos_director.json index 10e337f..a1111ee 100644 --- a/test/integration/roles/bareos_server.json +++ b/test/integration/roles/bareos_director.json @@ -1,6 +1,6 @@ { - "name": "bareos_server", - "description": "Backup server role", + "name": "bareos_director", + "description": "Bareos Director Role", "json_class": "Chef::Role", "default_attributes": { }, @@ -11,7 +11,7 @@ "role[bareos_client]", "recipe[chef-bareos::database]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::storage]", + "role[bareos_storage]", "recipe[chef-bareos::workstation]" ], "env_run_lists": { From 8137224ded51ebf48c888b656b5fe9eb7dde62e7 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:30:32 -0700 Subject: [PATCH 072/311] adding new required role for searching, also adds feature to split out storage --- test/integration/roles/bareos_storage.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/integration/roles/bareos_storage.json diff --git a/test/integration/roles/bareos_storage.json b/test/integration/roles/bareos_storage.json new file mode 100644 index 0000000..3d20bbf --- /dev/null +++ b/test/integration/roles/bareos_storage.json @@ -0,0 +1,15 @@ +{ + "name": "bareos_storage", + "description": "Bareos Storage Role", + "json_class": "Chef::Role", + "default_attributes": { + }, + "override_attributes": { + }, + "chef_type": "role", + "run_list": [ + "recipe[chef-bareos::storage]" + ], + "env_run_lists": { + } +} From b51552c4ec27120abed8017fe5337a1884861960 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:30:55 -0700 Subject: [PATCH 073/311] incorporating new changes into kitchen tests --- .kitchen.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index a42e286..e01a863 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -34,12 +34,12 @@ roles_path: test/integration/roles/ suites: - name: aio-server run_list: - - role[bareos_server] + - role[bareos_director] attributes: - name: aio-server-pools run_list: - - role[bareos_server] + - role[bareos_director] attributes: bareos: host_pools: '1' From 510e97a75303bc27d451dfc94a607f501a4e1adf Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:31:24 -0700 Subject: [PATCH 074/311] Adding new searchable role to better suit wrappers --- README.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a73df6b..474e206 100644 --- a/README.md +++ b/README.md @@ -116,9 +116,7 @@ Attribute | Description | Type | Default ## Roles ### bareos_client role (install the bareos client backup by default) - -You need to create a client role called ``bareos_client`` like this: - +You'll need a searchable client role named ``bareos_client``, for example : ``` { "name": "bareos_client", @@ -138,14 +136,12 @@ You need to create a client role called ``bareos_client`` like this: ``` This role has to be applied to all your clients so they can be backed up by this cookbook. -### bareos_server role (install the bareos server for scheduling backups) - -For the primary server, if not splitting out services, you need a role named ``bareos_server``, for example : - +### bareos_director role (install the bareos director for scheduling backups) +You'll need a searchable director role named ``bareos_director``, for example : ``` { - "name": "bareos_server", - "description": "Example Role for a Bareos server", + "name": "bareos_director", + "description": "Example Role for a Bareos director", "json_class": "Chef::Role", "default_attributes": { }, @@ -156,18 +152,39 @@ For the primary server, if not splitting out services, you need a role named ``b "role[bareos_client]", "recipe[chef-bareos::database]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::storage]", "recipe[chef-bareos::workstation]" ], "env_run_lists": { } } ``` +You can replace the ``chef-bareos`` with an encompasing wrapper if desired. You'll need to run chef-client on the backup server every time you add a new node. Client jobs should be created for you automatically. Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of clients. +### bareos_storage role (install the bareos storage daemon for data transfers) +You'll need a searchable storage role named ``bareos_storage``, for example : +``` +{ + "name": "bareos_storage", + "description": "Example Role for a Bareos storage", + "json_class": "Chef::Role", + "default_attributes": { + }, + "override_attributes": { + }, + "chef_type": "role", + "run_list": [ + "recipe[chef-bareos::storage]" + ], + "env_run_lists": { + } +} +``` +You can replace the ``chef-bareos`` with a storage wrapper recipe. + ## Recipes (More detail coming) * client * database From aab1fce9493badca3241dc8d2157fd3691a18e57 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:31:44 -0700 Subject: [PATCH 075/311] refactoring for use with roles again, better for wrappers --- recipes/client.rb | 2 +- recipes/storage.rb | 4 ++-- recipes/workstation.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/client.rb b/recipes/client.rb index 49bd8a9..9062d48 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -30,7 +30,7 @@ if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, 'recipes:chef-bareos\:\:server') + bareos_dir = search(:node, 'roles:bareos_director') end # Setup the configs for any local/remote File Daemons clients diff --git a/recipes/storage.rb b/recipes/storage.rb index 9184481..d9e03df 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -43,8 +43,8 @@ bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] else - bareos_sd = search(:node, 'recipes:chef-bareos\:\:storage') - bareos_dir = search(:node, 'recipes:chef-bareos\:\:server') + bareos_sd = search(:node, 'roles:bareos_storage') + bareos_dir = search(:node, 'roles:bareos_director') end # Setup the bareos-sd config diff --git a/recipes/workstation.rb b/recipes/workstation.rb index b341bcc..e674874 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -29,7 +29,7 @@ bareos_dir = node['bareos']['director']['servers'] node.default['bareos']['workstation']['solo_mode'] = '1' else - bareos_dir = search(:node, 'roles:bareos_server') + bareos_dir = search(:node, 'roles:bareos_director') end # Setup the bconsole config, pushes out list of bareos-dirs and if solo mode From 7db7eff72a59b673903facb31982573317d652ac Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:32:03 -0700 Subject: [PATCH 076/311] bumping for role refactor --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index ba82533..4ce8c1b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.5' +version '1.0.6' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 936ada437006753eed7ad6379f4e9d1fe4e5a2a0 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 29 Sep 2015 17:33:27 -0700 Subject: [PATCH 077/311] removing these old tests --- .../server-host-pools/serverspec/.rspec | 2 - .../serverspec/bareos_spec.rb | 28 ------ .../serverspec/spec/spec_helper.rb | 89 ------------------- .../serverspec/spec_helper.rb | 16 ---- 4 files changed, 135 deletions(-) delete mode 100644 test/integration/server-host-pools/serverspec/.rspec delete mode 100644 test/integration/server-host-pools/serverspec/bareos_spec.rb delete mode 100644 test/integration/server-host-pools/serverspec/spec/spec_helper.rb delete mode 100644 test/integration/server-host-pools/serverspec/spec_helper.rb diff --git a/test/integration/server-host-pools/serverspec/.rspec b/test/integration/server-host-pools/serverspec/.rspec deleted file mode 100644 index 83e16f8..0000000 --- a/test/integration/server-host-pools/serverspec/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/test/integration/server-host-pools/serverspec/bareos_spec.rb b/test/integration/server-host-pools/serverspec/bareos_spec.rb deleted file mode 100644 index bc63088..0000000 --- a/test/integration/server-host-pools/serverspec/bareos_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require 'spec_helper' - -describe package('bareos-director') do - it { should be_installed } -end - -describe service('bareos-dir') do - it { should be_enabled } - it { should be_running } -end - -describe package('bareos-storage') do - it { should be_installed } -end - -describe service('bareos-sd') do - it { should be_enabled } - it { should be_running } -end - -describe package('bareos-filedaemon') do - it { should be_installed } -end - -describe service('bareos-fd') do - it { should be_enabled } - it { should be_running } -end diff --git a/test/integration/server-host-pools/serverspec/spec/spec_helper.rb b/test/integration/server-host-pools/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/server-host-pools/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end diff --git a/test/integration/server-host-pools/serverspec/spec_helper.rb b/test/integration/server-host-pools/serverspec/spec_helper.rb deleted file mode 100644 index 8763eb5..0000000 --- a/test/integration/server-host-pools/serverspec/spec_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'serverspec' - -set :backend, :exec - -RSpec.configure do |c| - c.before :all do - set :path, '$PATH:/sbin:/usr/local/sbin' - end - - if ENV['ASK_SUDO_PASSWORD'] - require 'highline/import' - c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false } - else - c.sudo_password = ENV['SUDO_PASSWORD'] - end -end From 992a94892867ab34a28c065cc3450bb97fa92a7d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 30 Sep 2015 14:25:41 -0700 Subject: [PATCH 078/311] Disabling another rubocop cop --- .rubocop.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 9258859..3057bf2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,3 +18,5 @@ SingleSpaceBeforeFirstArg: Enabled: false Metrics/LineLength: Max: 180 +Style/FileName: + Enabled: false From d7d8fdfdc93296a7c9ef8cfc3610f7d44cbcb7ce Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 1 Oct 2015 16:27:37 -0700 Subject: [PATCH 079/311] correction to node attribute --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index e1e8965..ffd03e3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -8,7 +8,7 @@ if platform_family?('rhel', 'fedora') default['bareos']['yum_repository'] = 'bareos' - default['bareos']['description'] = 'Backup Archiving Recovery Open Sourced Current stable' + default['bareos']['description'] = "Backup Archiving REcovery Open Sourced Current #{node['bareos']['version']}" end case node['platform_family'] @@ -86,7 +86,7 @@ default['bareos']['director']['dir_subs'] = nil # Messages -default['bareos']['messages']['mail_to'] = "bareos@#{node['domain_name']}" +default['bareos']['messages']['mail_to'] = "bareos@#{node['domain']}" default['bareos']['messages']['default_messages'] = 'Standard' # Workstation From a25aca22e33821ec443683d46f328bb5085ddaa8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 1 Oct 2015 16:28:22 -0700 Subject: [PATCH 080/311] bump for sane attribute fix --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 4ce8c1b..ab084d7 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.6' +version '1.0.7' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 2605515acd65ce9d8bf25d9bf0c159d3f5feba5f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 1 Oct 2015 16:55:42 -0700 Subject: [PATCH 081/311] missed this at some point, should match attribute --- templates/default/bareos-dir.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 8c10a4a..384c8f8 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -31,7 +31,7 @@ Job { Schedule = "WeeklyCycleAfterBackup" RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl <%= node['bareos']['database']['catalog_name'] %>" RunAfterJob = "/usr/lib/bareos/scripts/delete_catalog_backup" - Write Bootstrap = "|/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" root@localhost" + Write Bootstrap = "|/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" <%= node['bareos']['messages']['mail_to'] %>" Priority = 11 # run after main backup } From e82974c4891f9a733bc4a38e7e5a58f6f19768ab Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 1 Oct 2015 16:56:02 -0700 Subject: [PATCH 082/311] fixing this to match attribute --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index ab084d7..30351e4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.7' +version '1.0.8' %w( centos redhat ).each do |os| supports os, '>= 6.0' From f96c442c98fcd194bf17f43789ffb12a2654d8f9 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 1 Oct 2015 23:16:20 -0700 Subject: [PATCH 083/311] Adding unit tests per lamont Contributing unit tests put forth by @lamont --- spec/spec_helper.rb | 4 ++ spec/unit/recipes/default_spec.rb | 71 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 spec/spec_helper.rb create mode 100644 spec/unit/recipes/default_spec.rb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..1d48dfc --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,4 @@ +require 'chefspec' +require 'chefspec/berkshelf' + +ChefSpec::Coverage.start! \ No newline at end of file diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb new file mode 100644 index 0000000..b9421b6 --- /dev/null +++ b/spec/unit/recipes/default_spec.rb @@ -0,0 +1,71 @@ +# +# Cookbook Name:: chef-bareos +# Spec:: default +# +# Copyright (c) 2015 The Authors, All Rights Reserved. + +require 'spec_helper' + +describe 'chef-bareos::default' do + + before do + allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original + allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') + end + + context 'When all attributes are default, on an unspecified platform' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'includes the client recipe' do + expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') + chef_run + end + + # it 'includes the openssl recipe' do + # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') + # chef_run + # end + + end + + context 'on an ubuntu 12.04 box' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'adds the apt repo' do + expect(chef_run).to add_apt_repository('bareos') + end + end + + context 'on an centos 6.6 box' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| + node.set['bareos']['yum_repository'] = 'bareos-repo-test' + node.set['bareos']['baseurl'] = "http://foo/bar" + end + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'adds the yum repo' do + expect(chef_run).to create_yum_repository('bareos-repo-test').with( baseurl: "http://foo/bar" ) + end + end + +end \ No newline at end of file From 9d3d362a0426f2d0a6cee141d8f088327c6fb5eb Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 2 Oct 2015 09:10:55 -0700 Subject: [PATCH 084/311] rubocop cleanup --- spec/spec_helper.rb | 2 +- spec/unit/recipes/default_spec.rb | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 1d48dfc..cef8e46 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,4 @@ require 'chefspec' require 'chefspec/berkshelf' -ChefSpec::Coverage.start! \ No newline at end of file +ChefSpec::Coverage.start! diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index b9421b6..d8c8a00 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -7,7 +7,6 @@ require 'spec_helper' describe 'chef-bareos::default' do - before do allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') @@ -32,7 +31,6 @@ # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') # chef_run # end - end context 'on an ubuntu 12.04 box' do @@ -54,7 +52,7 @@ let(:chef_run) do runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| node.set['bareos']['yum_repository'] = 'bareos-repo-test' - node.set['bareos']['baseurl'] = "http://foo/bar" + node.set['bareos']['baseurl'] = 'http://foo/bar' end runner.converge(described_recipe) end @@ -64,8 +62,7 @@ end it 'adds the yum repo' do - expect(chef_run).to create_yum_repository('bareos-repo-test').with( baseurl: "http://foo/bar" ) + expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') end end - -end \ No newline at end of file +end From c1646bb1e20f97b4790acf5b8dcf76c6370af3f4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 2 Oct 2015 13:39:06 -0700 Subject: [PATCH 085/311] unit test still not complete, backing out until i have time to focus on them --- {spec => test/future_unit_tests/spec}/spec_helper.rb | 0 .../future_unit_tests/spec}/unit/recipes/default_spec.rb | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {spec => test/future_unit_tests/spec}/spec_helper.rb (100%) rename {spec => test/future_unit_tests/spec}/unit/recipes/default_spec.rb (100%) diff --git a/spec/spec_helper.rb b/test/future_unit_tests/spec/spec_helper.rb similarity index 100% rename from spec/spec_helper.rb rename to test/future_unit_tests/spec/spec_helper.rb diff --git a/spec/unit/recipes/default_spec.rb b/test/future_unit_tests/spec/unit/recipes/default_spec.rb similarity index 100% rename from spec/unit/recipes/default_spec.rb rename to test/future_unit_tests/spec/unit/recipes/default_spec.rb From e07169ec55d10631c5c60538a12a2645a33f5d75 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 2 Oct 2015 17:02:32 -0700 Subject: [PATCH 086/311] removing fedora19 tests until i can sort out postgresql mem conf issues --- .kitchen.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index e01a863..bc4d993 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -23,7 +23,11 @@ platforms: - name: centos-7.1 - - name: fedora-19 + #- name: fedora-19 + # attributes: + # postgresql: + # config: + # work_mem: "32MB" - name: fedora-20 From a75f4cffec9e7827e3401a24673142c42e91eac3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 2 Oct 2015 17:02:57 -0700 Subject: [PATCH 087/311] bump with kitchen fedora19 change --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 30351e4..e7ee77e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.8' +version '1.0.9' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 41d38ff8c96a94f183c390ac030cae52d8d5af35 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 2 Oct 2015 17:03:55 -0700 Subject: [PATCH 088/311] Missing the .0 at end of platform url attribute --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index ffd03e3..ec69dd9 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -15,8 +15,8 @@ when 'debian' case node['platform'] when 'debian' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version']}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version']}/Release.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version'].to_i}.0/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version'].to_i}.0/Release.key" when 'ubuntu' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" From ede6b4d9bed9b8b4e691f42a466ecdb4a4056af4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:40:14 -0700 Subject: [PATCH 089/311] adding in virtual full testing for client configs --- .kitchen.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index bc4d993..15d29e1 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -46,4 +46,6 @@ suites: - role[bareos_director] attributes: bareos: - host_pools: '1' + clients: + host_pools: true + enable_vfulls: true From 23f2b9b1c5eecca67c0e270b8a0240e0060e9da8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:41:54 -0700 Subject: [PATCH 090/311] adding lots of new client config attributes, See README --- attributes/default.rb | 66 ++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index ec69dd9..fc0f5e7 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -38,6 +38,11 @@ default['bareos']['gpgkey'] = nil end +# Messages +default['bareos']['messages']['mail_to'] = "bareos@#{node['domain']}" +default['bareos']['messages']['default_messages'] = 'Standard' +default['bareos']['messages']['default_admin_messages'] = 'all, !skipped, !restored' + # Database default['bareos']['database']['catalog_name'] = 'MyCatalog' default['bareos']['database']['database_type'] = 'postgresql' # postgresql/mysql @@ -45,31 +50,60 @@ default['bareos']['database']['dbname'] = 'bareos' default['bareos']['database']['dbuser'] = 'bareos' default['bareos']['database']['dbpassword'] = '' -# default['bareos']['database']['dbaddress'] = nil +default['bareos']['database']['dbaddress'] = nil # Clients default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 -default['bareos']['clients']['client_list'] = {} # Hashes are generally better +default['bareos']['clients']['client_list'] = {} # {'foo.bar.org','boo.ya.org'} default['bareos']['clients']['file_retention'] = '30 days' default['bareos']['clients']['job_retention'] = '6 months' -default['bareos']['clients']['autoprune'] = 'no' +default['bareos']['clients']['autoprune'] = 'yes' default['bareos']['clients']['heartbeat_interval'] = 600 +default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' +default['bareos']['clients']['spool_data'] = 'no' default['bareos']['clients']['jobdef_default_runlevel'] = 10 -default['bareos']['clients']['jobdef_default_storage'] = 'File' -default['bareos']['clients']['jobdef_default_messages'] = 'Standard' -default['bareos']['clients']['jobdef_default_fileset'] = 'Full Set' default['bareos']['clients']['jobdef_default_schedule'] = 'WeeklyCycle' -default['bareos']['clients']['host_pools'] = '0' # Default is disabled, normal pools, see below -default['bareos']['clients']['default_pool'] = 'Default' -default['bareos']['clients']['full_pool'] = 'Full-Pool' -default['bareos']['clients']['incremental_pool'] = 'Inc-Pool' -default['bareos']['clients']['differential_pool'] = 'Diff-Pool' -default['bareos']['clients']['enable_vfulls'] = false # Needs more work within host template +default['bareos']['clients']['jobdef_default_messages'] = "#{node['bareos']['messages']['default_messages']}" +default['bareos']['clients']['jobdef_default_storage'] = 'File' +default['bareos']['clients']['jobdef_default_fileset'] ="#{node['fqdn']}-Fileset" +default['bareos']['clients']['storage'] = "#{node['bareos']['clients']['jobdef_default_storage']}" +default['bareos']['clients']['fileset'] = "#{node['bareos']['clients']['jobdef_default_fileset']}" +default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below +case node['bareos']['clients']['host_pools'] +when true + default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" + default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" + default['bareos']['clients']['differential_pool'] = "#{node['fqdn']}-Diff-Pool" + default['bareos']['clients']['default_pool'] = "#{node['fqdn']}-Default-Pool" +when false + default['bareos']['clients']['full_pool'] = 'File-Full-Pool' + default['bareos']['clients']['incremental_pool'] = 'File-Inc-Pool' + default['bareos']['clients']['differential_pool'] = 'File-Diff-Pool' + default['bareos']['clients']['default_pool'] = 'File-Default-Pool' +end +default['bareos']['clients']['enable_vfulls'] = false +default['bareos']['clients']['vfull_pool'] = node['bareos']['clients']['full_pool'] +default['bareos']['clients']['vfull_priority'] = 9 +default['bareos']['clients']['vfull_accurate'] = 'no' # More sane option is no, yes is preferred if possible +default['bareos']['clients']['vfull_spool'] = 'no' # Not useful in most cases but available +default['bareos']['clients']['vfull_schedule'] = "#{node['fqdn']}-VFullSchedule" +default['bareos']['clients']['vfull_concurrent_jobs'] = 6 +default['bareos']['clients']['vfull_duplicate_jobs'] = 'no' +default['bareos']['clients']['vfull_cancel_low_duplicates'] = 'yes' +default['bareos']['clients']['vfull_reschedule_on_fail'] = 'yes' +default['bareos']['clients']['vfull_reschedule_interval'] = '30 minutes' +default['bareos']['clients']['vfull_reschedule_times'] = 1 # Storage Daemon default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks +case node['bareos']['storage']['tape'] +when true + default['bareos']['storage']['main_storage'] = 'TapeLibrary' # When enabled change to appropriate label in wrapper +when false + default['bareos']['storage']['main_storage'] = 'File' +end default['bareos']['storage']['servers'] = {} # Use FQDN of each server for consistancy in solo mode default['bareos']['storage']['custom_configs'] = '0' default['bareos']['storage']['sd_mon_enable'] = 'yes' @@ -78,16 +112,14 @@ # Director default['bareos']['director']['dir_port'] = 9101 default['bareos']['director']['dir_max_concurrent_jobs'] = 20 -default['bareos']['director']['custom_configs'] = '1' +default['bareos']['director']['custom_configs'] = true default['bareos']['director']['servers'] = {} # Use FQDN of each server for consistancy in solo mode +default['bareos']['director']['console_commandacl'] = 'status, .status' +default['bareos']['director']['heartbeat_interval'] = 600 # Subscription Management (Director) default['bareos']['director']['dir_subscription'] = nil default['bareos']['director']['dir_subs'] = nil -# Messages -default['bareos']['messages']['mail_to'] = "bareos@#{node['domain']}" -default['bareos']['messages']['default_messages'] = 'Standard' - # Workstation default['bareos']['workstation']['solo_mode'] = '0' From 1bd3a4ed3b5ec5fe1348316b14649fe53ca349a3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:42:45 -0700 Subject: [PATCH 091/311] rework of host based pools and how they land in template --- recipes/server.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 57e6d06..fba0cdd 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -78,23 +78,18 @@ # Account for any number of clients, setup the client config on the director machine # Also push out whether to do custom client pools in chef-solo or chef-client mode bareos_clients.each do |client| - # Special logic to determine how to extract fqdn if Chef::Config[:solo] client_fqdn = client else client_fqdn = client['fqdn'] end - template "/etc/bareos/bareos-dir.d/clients/#{client_fqdn}.conf" do source 'client.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - bareos_client: client_fqdn, - client_full_pool: "#{client_fqdn}-Full-Pool", - client_inc_pool: "#{client_fqdn}-Inc-Pool", - client_diff_pool: "#{client_fqdn}-Diff-Pool" + bareos_client: client_fqdn ) notifies :run, 'execute[reload-dir]', :delayed end From ac091c9b4eb0cb38bba198f58ac93f6a6fb00f72 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:44:32 -0700 Subject: [PATCH 092/311] reworking several pieces of this template (pools,message,main fileset,attributes) --- templates/default/bareos-dir.conf.erb | 100 ++++++++++++-------------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 384c8f8..cfa8863 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -14,7 +14,7 @@ Director { Maximum Concurrent Jobs = <%= node['bareos']['director']['dir_max_concurrent_jobs'] %> Password = "<%= node['bareos']['dir_password'] %>" Messages = Daemon - Heartbeat Interval = 600 + Heartbeat Interval = <%= node['bareos']['director']['heartbeat_interval'] %> <% if node['bareos']['director']['dir_subscription'] == true %> Subscriptions = <%= node['bareos']['dir_subs'] %> <% end %> @@ -27,34 +27,47 @@ Job { Name = "<%= node['fqdn'] %>-BackupCatalog" JobDefs = "<%= node['fqdn'] %>-JobDef" Level = Full - FileSet="Catalog" + FileSet = "Catalog" Schedule = "WeeklyCycleAfterBackup" RunBeforeJob = "/usr/lib/bareos/scripts/make_catalog_backup.pl <%= node['bareos']['database']['catalog_name'] %>" RunAfterJob = "/usr/lib/bareos/scripts/delete_catalog_backup" Write Bootstrap = "|/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \" -s \"Bootstrap for Job %j\" <%= node['bareos']['messages']['mail_to'] %>" - Priority = 11 # run after main backup + Priority = 11 # run after main backup } -############ -# Filesets # -############ +#################### +# Default Filesets # +#################### FileSet { Name = "Full Set" Include { Options { signature = MD5 } - File = /etc - File = /home + File = / + Exclude Dir Containing = .bareos_ignore } - Exclude { File = /var/lib/bareos File = /var/lib/bareos/storage + File = /var/lib/pgsql + File = /var/lib/mysql File = /proc File = /tmp File = /.journal File = /.fsck + File = /spool + } +} + +FileSet { + Name = "Catalog" + Include { + Options { + signature = MD5 + } + File = "/var/lib/bareos/bareos.sql" # database dump + File = "/etc/bareos" # configuration } } @@ -77,20 +90,9 @@ FileSet { # } # } -FileSet { - Name = "Catalog" - Include { - Options { - signature = MD5 - } - File = "/var/lib/bareos/bareos.sql" # database dump - File = "/etc/bareos" # configuration - } -} - -############# -# Schedules # -############# +##################### +# Default Schedules # +##################### Schedule { Name = "WeeklyCycle" Run = Full 1st sun at 23:05 @@ -103,20 +105,20 @@ Schedule { Run = Full sun-sat at 23:10 } -############ -# Storages # -############ +################### +# Default Storage # +################### Storage { Name = File - Address = <%= node['fqdn'] %> # N.B. Use a fully qualified name here + Address = <%= node['fqdn'] %> # N.B. Use a fully qualified name here Password = "<%= node['bareos']['sd_password'] %>" Device = FileStorage Media Type = File } -############ -# Catalogs # -############ +################### +# Default Catalog # +################### Catalog { Name = <%= node['bareos']['database']['catalog_name'] %> dbdriver = "<%= @db_driver %>" @@ -134,92 +136,82 @@ Catalog { Console { Name = <%= node['fqdn'] %>-mon Password = "<%= node['bareos']['mon_password'] %>" - CommandACL = status, .status + CommandACL = <%= node['bareos']['director']['console_commandacl'] %> } Messages { Name = Standard mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos: %t %e of %c %l\" %r" operatorcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos: Intervention needed for %j\" %r" - mail = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped + mail on error = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped operator = <%= node['bareos']['messages']['mail_to'] %> = mount console = all, !skipped, !saved - append = "/var/log/bareos/bareos.log" = all, !skipped + append = "/var/log/bareos/bareos.log" = all, !skipped, !restored catalog = all } Messages { Name = Daemon mailcommand = "/usr/sbin/bsmtp -h localhost -f \"\(Bareos\) \<\%r\>\" -s \"Bareos daemon message\" %r" - mail = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped + mail on error = <%= node['bareos']['messages']['mail_to'] %> = all, !skipped console = all, !skipped, !saved append = "/var/log/bareos/bareos.log" = all, !skipped + catalog = all } ################# # Default Pools # ################# -# Pool { -# Name = File -# Pool Type = Backup -# Recycle = yes -# AutoPrune = yes -# Volume Retention = 1 year -# Maximum Volume Bytes = 10G -# Maximum Volumes = 100 -# LabelFormat = "FileVol-" -# } - Pool { - Name = Default + Name = File-Default-Pool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 30 days Maximum Volume Bytes = 10G Maximum Volumes = 100 - LabelFormat = "DefaultVol-" + LabelFormat = "FileDefaultVol-" } Pool { - Name = Full-Pool + Name = File-Full-Pool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 6 months Maximum Volume Bytes = 10G Maximum Volumes = 100 - LabelFormat = "Full-" + LabelFormat = "FileFullVol-" } Pool { - Name = Inc-Pool + Name = File-Inc-Pool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 2 months Maximum Volume Bytes = 10G Maximum Volumes = 100 - LabelFormat = "Inc-" + LabelFormat = "FileIncVol-" } Pool { - Name = Diff-Pool + Name = File-Diff-Pool Pool Type = Backup Recycle = yes AutoPrune = yes Volume Retention = 4 months Maximum Volume Bytes = 10G Maximum Volumes = 100 - LabelFormat = "Diff-" + LabelFormat = "FileDiffVol-" } Pool { Name = Scratch Pool Type = Backup } -<% if node['bareos']['director']['custom_configs'] == '1' %> +<% if node['bareos']['director']['custom_configs'] %> ########################################### # Custom Director Daemon Config Locations # From 6a1080c12d81ae664db3596a2e1f0c15dbc8fa3f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:45:27 -0700 Subject: [PATCH 093/311] making message params better, minor edit --- templates/default/bareos-fd.conf.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index 8f60a29..f80b9f8 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -13,7 +13,7 @@ FileDaemon { <% @bareos_dir.each do |director| %> ########## -# Director/Monitor Resources for <%= director['fqdn'] %> # +# Director/Monitor Resources for <%= director['fqdn'] %> ########## Director { Name = <%= director['fqdn'] %>-dir @@ -28,6 +28,6 @@ Director { Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <%= director['fqdn'] %>-dir = all + director = <%= director['fqdn'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> } <% end %> From f5e621608a17a65723214d1f6792d58f97ed89b2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:45:56 -0700 Subject: [PATCH 094/311] better message resource --- templates/default/bareos-sd.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 65adec2..e3a5520 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -27,7 +27,7 @@ Director { Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <%= director['fqdn'] %>-dir = all + director = <%= director['fqdn'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> } ########## From 3404b322fddf0e873b9d2ab0bc65b4e0d42bd35a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:47:35 -0700 Subject: [PATCH 095/311] reworking host pools, adding vfulls (initial), adding host fileset --- templates/default/client.conf.erb | 103 ++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 26 deletions(-) diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 9fadd8e..b431ac5 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -9,7 +9,7 @@ Client { Address = <%= @bareos_client %> FDPort = <%= node['bareos']['clients']['fd_port'] %> Catalog = <%= node['bareos']['database']['catalog_name'] %> - Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon + Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon File Retention = <%= node['bareos']['clients']['file_retention'] %> Job Retention = <%= node['bareos']['clients']['job_retention'] %> AutoPrune = <%= node['bareos']['clients']['autoprune'] %> @@ -26,22 +26,12 @@ JobDefs { Storage = <%= node['bareos']['clients']['jobdef_default_storage'] %> Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> Pool = <%= node['bareos']['clients']['default_pool'] %> - # Each client can have its own Pool to help with certain cases -<% if node['bareos']['clients']['host_pools'] == '1' %> - FullBackupPool = <%= @client_full_pool %> - IncrementalBackupPool = <%= @client_inc_pool %> - DifferentialBackupPool = <%= @client_diff_pool %> -<% elsif node['bareos']['clients']['host_pools'] == '0' %> FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> -<% else %> - # FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> - # IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> - # DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> -<% end %> Priority = <%= node['bareos']['clients']['jobdef_default_runlevel'] %> Write Bootstrap = "/var/lib/bareos/%c.bsr" + SpoolData = <%= node['bareos']['clients']['spool_data'] %> } # Default Job @@ -55,27 +45,88 @@ Job { Name = "<%= @bareos_client %>-Restore" Type = Restore Client = <%= @bareos_client %>-fd - FileSet= "Full Set" - Storage = File -<% if node['bareos']['clients']['host_pools'] == '1' %> - Pool = <%= @client_full_pool %> -<% else %> + FileSet = <%= node['bareos']['clients']['fileset'] %> + Storage = <%= node['bareos']['clients']['storage'] %> Pool = <%= node['bareos']['clients']['full_pool'] %> -<% end %> - Messages = Standard + Messages = <%= node['bareos']['messages']['default_messages'] %> Where = /tmp/<%= @bareos_client %>_restored/ } -<% if node['bareos']['clients']['enable_vfulls'] == '1' %> +FileSet { + Name = <%= node['bareos']['clients']['fileset'] %> + Include { + Options { + signature = MD5 + } + File = / + Exclude Dir Containing = .bareos_ignore + } + Exclude { + File = /var/lib/bareos + File = /var/lib/bareos/storage + File = /var/lib/pgsql + File = /var/lib/mysql + File = /proc + File = /tmp + File = /.journal + File = /.fsck + File = /spool + } +} + +<% if node['bareos']['clients']['enable_vfulls'] %> # VirtualFull Job - <%# Need some logic here to determine whether to use %> - <%# VirtualFull backups or not %> +Job { + Name = "<%= @bareos_client %>-VFullJob" + Client = <%= @bareos_client %>-fd + JobDefs = "<%= @bareos_client %>-VFullJobDef" + FileSet = <%= node['bareos']['clients']['fileset'] %> + Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> +} + +JobDefs { + Name = "<%= @bareos_client %>-VFullJobDef" + Type = Backup + Level = VirtualFull + Client = <%= @bareos_client %>-fd + FileSet = <%= node['bareos']['clients']['fileset'] %> + Schedule = "<%= node['bareos']['clients']['vfull_schedule'] %>" + Storage = <%= node['bareos']['storage']['main_storage'] %> + Messages = <%= node['bareos']['messages']['default_messages'] %> + Pool = <%= node['bareos']['clients']['vfull_pool'] %> + IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> + FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> + Priority = <%= node['bareos']['clients']['vfull_priority'] %> + Write Bootstrap = "<%= node['bareos']['clients']['bootstrap_file'] %>" + SpoolData = <%= node['bareos']['clients']['vfull_spool'] %> + Maximum Concurrent Jobs = <%= node['bareos']['clients']['vfull_concurrent_jobs'] %> + Allow Duplicate Jobs = <%= node['bareos']['clients']['vfull_duplicate_jobs'] %> + Cancel Lower Level Duplicates = <%= node['bareos']['clients']['vfull_cancel_low_duplicates'] %> + Reschedule On Error = <%= node['bareos']['clients']['vfull_reschedule_on_fail'] %> + Reschedule Interval = <%= node['bareos']['clients']['vfull_reschedule_interval'] %> + Reschedule Times = <%= node['bareos']['clients']['vfull_reschedule_times'] %> + Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> +} + +Schedule { + Name = <%= node['bareos']['clients']['vfull_schedule'] %> + Run = Level=VirtualFull on 1 at 3:00 +} <% end %> -<% if node['bareos']['clients']['host_pools'] == '1' %> +<% if node['bareos']['clients']['host_pools'] -%> # Individual host pools for better tape library/storage utilization Pool { - Name = <%= @client_full_pool %> + Name = <%= node['bareos']['clients']['default_pool'] %> + Pool Type = Backup + Recycle = yes + AutoPrune = yes + Volume Retention = 7 days +} + +Pool { + Name = <%= node['bareos']['clients']['full_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes @@ -83,7 +134,7 @@ Pool { } Pool { - Name = <%= @client_inc_pool %> + Name = <%= node['bareos']['clients']['incremental_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes @@ -91,7 +142,7 @@ Pool { } Pool { - Name = <%= @client_diff_pool %> + Name = <%= node['bareos']['clients']['differential_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes From 73a5c1101d3b43f7c17aa7e316a3c0a88f9700e1 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:49:48 -0700 Subject: [PATCH 096/311] foodcritic cleanup --- attributes/default.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index fc0f5e7..4eda43a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -64,11 +64,11 @@ default['bareos']['clients']['spool_data'] = 'no' default['bareos']['clients']['jobdef_default_runlevel'] = 10 default['bareos']['clients']['jobdef_default_schedule'] = 'WeeklyCycle' -default['bareos']['clients']['jobdef_default_messages'] = "#{node['bareos']['messages']['default_messages']}" +default['bareos']['clients']['jobdef_default_messages'] = node['bareos']['messages']['default_messages'] default['bareos']['clients']['jobdef_default_storage'] = 'File' -default['bareos']['clients']['jobdef_default_fileset'] ="#{node['fqdn']}-Fileset" -default['bareos']['clients']['storage'] = "#{node['bareos']['clients']['jobdef_default_storage']}" -default['bareos']['clients']['fileset'] = "#{node['bareos']['clients']['jobdef_default_fileset']}" +default['bareos']['clients']['jobdef_default_fileset'] = "#{node['fqdn']}-Fileset" +default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] +default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below case node['bareos']['clients']['host_pools'] when true From a8e8d5d6389ac8dbcd2624bae3214926156b3fe4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 16:50:26 -0700 Subject: [PATCH 097/311] adding vfulls and reworking several aspects of pools --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index e7ee77e..21fde5c 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.0.9' +version '1.1.0' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 42d70f938ba6c5be5a1ca1aadde7b05c2cec3e62 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 17:21:48 -0700 Subject: [PATCH 098/311] needed to retain the @bareos_client for incoming future clients --- templates/default/client.conf.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index b431ac5..714e69f 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -21,7 +21,7 @@ JobDefs { Type = Backup Level = Incremental Client = <%= @bareos_client %>-fd - FileSet = "<%= node['bareos']['clients']['jobdef_default_fileset'] %>" + FileSet = "<%= @bareos_client %>-Fileset" Schedule = "<%= node['bareos']['clients']['jobdef_default_schedule'] %>" Storage = <%= node['bareos']['clients']['jobdef_default_storage'] %> Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> @@ -45,7 +45,7 @@ Job { Name = "<%= @bareos_client %>-Restore" Type = Restore Client = <%= @bareos_client %>-fd - FileSet = <%= node['bareos']['clients']['fileset'] %> + FileSet = "<%= @bareos_client %>-Fileset" Storage = <%= node['bareos']['clients']['storage'] %> Pool = <%= node['bareos']['clients']['full_pool'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> @@ -53,7 +53,7 @@ Job { } FileSet { - Name = <%= node['bareos']['clients']['fileset'] %> + Name = "<%= @bareos_client %>-Fileset" Include { Options { signature = MD5 @@ -80,7 +80,7 @@ Job { Name = "<%= @bareos_client %>-VFullJob" Client = <%= @bareos_client %>-fd JobDefs = "<%= @bareos_client %>-VFullJobDef" - FileSet = <%= node['bareos']['clients']['fileset'] %> + FileSet = "<%= @bareos_client %>-Fileset" Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> } @@ -89,7 +89,7 @@ JobDefs { Type = Backup Level = VirtualFull Client = <%= @bareos_client %>-fd - FileSet = <%= node['bareos']['clients']['fileset'] %> + FileSet = "<%= @bareos_client %>-Fileset" Schedule = "<%= node['bareos']['clients']['vfull_schedule'] %>" Storage = <%= node['bareos']['storage']['main_storage'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> From 416ac5e44cdb844bc9ccb5612a2bc9233fea623f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 5 Oct 2015 17:22:12 -0700 Subject: [PATCH 099/311] bump for bugfix to client template --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 21fde5c..e5b138f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.0' +version '1.1.1' %w( centos redhat ).each do |os| supports os, '>= 6.0' From af81ebd4442a1f3742a386a0627397c962731890 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 6 Oct 2015 15:54:14 -0700 Subject: [PATCH 100/311] attempting a fix for remote client fd password mismatch bug --- attributes/default.rb | 2 +- metadata.rb | 2 +- recipes/server.rb | 9 ++----- templates/default/client.conf.erb | 40 +++++++++++++++---------------- 4 files changed, 24 insertions(+), 29 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 4eda43a..3115103 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -55,7 +55,7 @@ # Clients default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 -default['bareos']['clients']['client_list'] = {} # {'foo.bar.org','boo.ya.org'} +default['bareos']['clients']['client_list'] = %w(node) # {'foo.bar.org','boo.ya.org'} default['bareos']['clients']['file_retention'] = '30 days' default['bareos']['clients']['job_retention'] = '6 months' default['bareos']['clients']['autoprune'] = 'yes' diff --git a/metadata.rb b/metadata.rb index e5b138f..9a7fb30 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.1' +version '1.1.2' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index fba0cdd..dd3c91b 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -78,18 +78,13 @@ # Account for any number of clients, setup the client config on the director machine # Also push out whether to do custom client pools in chef-solo or chef-client mode bareos_clients.each do |client| - if Chef::Config[:solo] - client_fqdn = client - else - client_fqdn = client['fqdn'] - end - template "/etc/bareos/bareos-dir.d/clients/#{client_fqdn}.conf" do + template "/etc/bareos/bareos-dir.d/clients/#{client['fqdn']}.conf" do source 'client.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - bareos_client: client_fqdn + bareos_client: client ) notifies :run, 'execute[reload-dir]', :delayed end diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 714e69f..0d36b9d 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -5,11 +5,11 @@ # Bareos Client Configuration File Client { - Name = <%= @bareos_client %>-fd - Address = <%= @bareos_client %> + Name = <%= @bareos_client['fqdn'] %>-fd + Address = <%= @bareos_client['fqdn'] %> FDPort = <%= node['bareos']['clients']['fd_port'] %> Catalog = <%= node['bareos']['database']['catalog_name'] %> - Password = "<%= node['bareos']['fd_password'] %>" # password for FileDaemon + Password = "<%= @bareos_client['bareos']['fd_password'] %>" # password for FileDaemon File Retention = <%= node['bareos']['clients']['file_retention'] %> Job Retention = <%= node['bareos']['clients']['job_retention'] %> AutoPrune = <%= node['bareos']['clients']['autoprune'] %> @@ -17,11 +17,11 @@ Client { } JobDefs { - Name = "<%= @bareos_client %>-JobDef" + Name = "<%= @bareos_client['fqdn'] %>-JobDef" Type = Backup Level = Incremental - Client = <%= @bareos_client %>-fd - FileSet = "<%= @bareos_client %>-Fileset" + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" Schedule = "<%= node['bareos']['clients']['jobdef_default_schedule'] %>" Storage = <%= node['bareos']['clients']['jobdef_default_storage'] %> Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> @@ -36,24 +36,24 @@ JobDefs { # Default Job Job { - Name = "<%= @bareos_client %>-Job" - JobDefs = "<%= @bareos_client %>-JobDef" + Name = "<%= @bareos_client['fqdn'] %>-Job" + JobDefs = "<%= @bareos_client['fqdn'] %>-JobDef" } # Restore Job Job { - Name = "<%= @bareos_client %>-Restore" + Name = "<%= @bareos_client['fqdn'] %>-Restore" Type = Restore - Client = <%= @bareos_client %>-fd - FileSet = "<%= @bareos_client %>-Fileset" + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" Storage = <%= node['bareos']['clients']['storage'] %> Pool = <%= node['bareos']['clients']['full_pool'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> - Where = /tmp/<%= @bareos_client %>_restored/ + Where = /tmp/<%= @bareos_client['fqdn'] %>_restored/ } FileSet { - Name = "<%= @bareos_client %>-Fileset" + Name = "<%= @bareos_client['fqdn'] %>-Fileset" Include { Options { signature = MD5 @@ -77,19 +77,19 @@ FileSet { <% if node['bareos']['clients']['enable_vfulls'] %> # VirtualFull Job Job { - Name = "<%= @bareos_client %>-VFullJob" - Client = <%= @bareos_client %>-fd - JobDefs = "<%= @bareos_client %>-VFullJobDef" - FileSet = "<%= @bareos_client %>-Fileset" + Name = "<%= @bareos_client['fqdn'] %>-VFullJob" + Client = <%= @bareos_client['fqdn'] %>-fd + JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> } JobDefs { - Name = "<%= @bareos_client %>-VFullJobDef" + Name = "<%= @bareos_client['fqdn'] %>-VFullJobDef" Type = Backup Level = VirtualFull - Client = <%= @bareos_client %>-fd - FileSet = "<%= @bareos_client %>-Fileset" + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" Schedule = "<%= node['bareos']['clients']['vfull_schedule'] %>" Storage = <%= node['bareos']['storage']['main_storage'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> From 7310a94df359a50c439861f7097c6f782c2c1344 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 6 Oct 2015 16:26:14 -0700 Subject: [PATCH 101/311] bump for more client based bugfix bits --- metadata.rb | 2 +- templates/default/client.conf.erb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/metadata.rb b/metadata.rb index 9a7fb30..bcbd670 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.2' +version '1.1.3' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 0d36b9d..ebb5e7c 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -118,7 +118,7 @@ Schedule { <% if node['bareos']['clients']['host_pools'] -%> # Individual host pools for better tape library/storage utilization Pool { - Name = <%= node['bareos']['clients']['default_pool'] %> + Name = <%= @bareos_client['bareos']['clients']['default_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes @@ -126,7 +126,7 @@ Pool { } Pool { - Name = <%= node['bareos']['clients']['full_pool'] %> + Name = <%= @bareos_client['bareos']['clients']['full_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes @@ -134,7 +134,7 @@ Pool { } Pool { - Name = <%= node['bareos']['clients']['incremental_pool'] %> + Name = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes @@ -142,7 +142,7 @@ Pool { } Pool { - Name = <%= node['bareos']['clients']['differential_pool'] %> + Name = <%= @bareos_client['bareos']['clients']['differential_pool'] %> Pool Type = Backup Recycle = yes AutoPrune = yes From 94f2f00ac4313fe849c2544d7b1337a95c5c0df2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 6 Oct 2015 16:41:55 -0700 Subject: [PATCH 102/311] Did not specify attribute necessary --- metadata.rb | 2 +- templates/default/client.conf.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index bcbd670..2735a95 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.3' +version '1.1.4' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index ebb5e7c..4f43863 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -1,5 +1,5 @@ <%# BAREOS CLIENT TEMPLATE %> -# Generated by Chef for <%= @bareos_client %>-fd +# Generated by Chef for <%= @bareos_client['fqdn'] %>-fd # Local modifications will be overwritten. # # Bareos Client Configuration File From 6e4f8ba3ebead2bef7c59da2cd442ace98e8e76d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 6 Oct 2015 17:16:04 -0700 Subject: [PATCH 103/311] playing with client attribute authority (node/server) --- metadata.rb | 2 +- templates/default/client.conf.erb | 54 +++++++++++++++---------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/metadata.rb b/metadata.rb index 2735a95..74a01c5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.4' +version '1.1.5' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 4f43863..b7456d4 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -7,13 +7,13 @@ Client { Name = <%= @bareos_client['fqdn'] %>-fd Address = <%= @bareos_client['fqdn'] %> - FDPort = <%= node['bareos']['clients']['fd_port'] %> + FDPort = <%= @bareos_client['bareos']['clients']['fd_port'] %> Catalog = <%= node['bareos']['database']['catalog_name'] %> Password = "<%= @bareos_client['bareos']['fd_password'] %>" # password for FileDaemon - File Retention = <%= node['bareos']['clients']['file_retention'] %> - Job Retention = <%= node['bareos']['clients']['job_retention'] %> - AutoPrune = <%= node['bareos']['clients']['autoprune'] %> - Maximum Concurrent Jobs = <%= node['bareos']['clients']['max_concurrent_jobs'] %> + File Retention = <%= @bareos_client['bareos']['clients']['file_retention'] %> + Job Retention = <%= @bareos_client['bareos']['clients']['job_retention'] %> + AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> + Maximum Concurrent Jobs = <%= @bareos_client['bareos']['clients']['max_concurrent_jobs'] %> } JobDefs { @@ -22,16 +22,16 @@ JobDefs { Level = Incremental Client = <%= @bareos_client['fqdn'] %>-fd FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= node['bareos']['clients']['jobdef_default_schedule'] %>" - Storage = <%= node['bareos']['clients']['jobdef_default_storage'] %> + Schedule = "<%= @bareos_client['bareos']['clients']['jobdef_default_schedule'] %>" + Storage = <%= @bareos_client['bareos']['clients']['jobdef_default_storage'] %> Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> - Pool = <%= node['bareos']['clients']['default_pool'] %> - FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> - IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> - Priority = <%= node['bareos']['clients']['jobdef_default_runlevel'] %> + Pool = <%= @bareos_client['bareos']['clients']['default_pool'] %> + FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> + Priority = <%= @bareos_client['bareos']['clients']['jobdef_default_runlevel'] %> Write Bootstrap = "/var/lib/bareos/%c.bsr" - SpoolData = <%= node['bareos']['clients']['spool_data'] %> + SpoolData = <%= @bareos_client['bareos']['clients']['spool_data'] %> } # Default Job @@ -46,8 +46,8 @@ Job { Type = Restore Client = <%= @bareos_client['fqdn'] %>-fd FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Storage = <%= node['bareos']['clients']['storage'] %> - Pool = <%= node['bareos']['clients']['full_pool'] %> + Storage = <%= @bareos_client['bareos']['clients']['storage'] %> + Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> Where = /tmp/<%= @bareos_client['fqdn'] %>_restored/ } @@ -74,14 +74,14 @@ FileSet { } } -<% if node['bareos']['clients']['enable_vfulls'] %> +<% if @bareos_client['bareos']['clients']['enable_vfulls'] %> # VirtualFull Job Job { Name = "<%= @bareos_client['fqdn'] %>-VFullJob" Client = <%= @bareos_client['fqdn'] %>-fd JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> + Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> } JobDefs { @@ -90,32 +90,32 @@ JobDefs { Level = VirtualFull Client = <%= @bareos_client['fqdn'] %>-fd FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= node['bareos']['clients']['vfull_schedule'] %>" - Storage = <%= node['bareos']['storage']['main_storage'] %> + Schedule = "<%= @bareos_client['bareos']['clients']['vfull_schedule'] %>" + Storage = <%= @bareos_client['bareos']['storage']['main_storage'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> - Pool = <%= node['bareos']['clients']['vfull_pool'] %> - IncrementalBackupPool = <%= node['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= node['bareos']['clients']['differential_pool'] %> - FullBackupPool = <%= node['bareos']['clients']['full_pool'] %> + Pool = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> + IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> + FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> Priority = <%= node['bareos']['clients']['vfull_priority'] %> Write Bootstrap = "<%= node['bareos']['clients']['bootstrap_file'] %>" - SpoolData = <%= node['bareos']['clients']['vfull_spool'] %> + SpoolData = <%= @bareos_client['bareos']['clients']['vfull_spool'] %> Maximum Concurrent Jobs = <%= node['bareos']['clients']['vfull_concurrent_jobs'] %> Allow Duplicate Jobs = <%= node['bareos']['clients']['vfull_duplicate_jobs'] %> Cancel Lower Level Duplicates = <%= node['bareos']['clients']['vfull_cancel_low_duplicates'] %> Reschedule On Error = <%= node['bareos']['clients']['vfull_reschedule_on_fail'] %> Reschedule Interval = <%= node['bareos']['clients']['vfull_reschedule_interval'] %> Reschedule Times = <%= node['bareos']['clients']['vfull_reschedule_times'] %> - Accurate = <%= node['bareos']['clients']['vfull_accurate'] %> + Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> } Schedule { - Name = <%= node['bareos']['clients']['vfull_schedule'] %> + Name = <%= @bareos_client['bareos']['clients']['vfull_schedule'] %> Run = Level=VirtualFull on 1 at 3:00 } <% end %> -<% if node['bareos']['clients']['host_pools'] -%> +<% if @bareos_client['bareos']['clients']['host_pools'] %> # Individual host pools for better tape library/storage utilization Pool { Name = <%= @bareos_client['bareos']['clients']['default_pool'] %> From a1c8512888a7d4e91609762218fc8edb5518be04 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 7 Oct 2015 11:32:53 -0700 Subject: [PATCH 104/311] trying this instead for logic for host-pools --- attributes/default.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 3115103..ddb770f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -70,13 +70,12 @@ default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below -case node['bareos']['clients']['host_pools'] -when true +if node['bareos']['clients']['host_pools'] == true default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" default['bareos']['clients']['differential_pool'] = "#{node['fqdn']}-Diff-Pool" default['bareos']['clients']['default_pool'] = "#{node['fqdn']}-Default-Pool" -when false +else default['bareos']['clients']['full_pool'] = 'File-Full-Pool' default['bareos']['clients']['incremental_pool'] = 'File-Inc-Pool' default['bareos']['clients']['differential_pool'] = 'File-Diff-Pool' From a7381fdca13360724f6e990c05c825b8e819aa2e Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 7 Oct 2015 11:33:14 -0700 Subject: [PATCH 105/311] bump for attribute logic change --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 74a01c5..5058eef 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.5' +version '1.1.6' %w( centos redhat ).each do |os| supports os, '>= 6.0' From e0c5d017d4204dc74711c4bb556587af6d8d76ae Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 8 Oct 2015 16:27:10 -0700 Subject: [PATCH 106/311] playing with pool logic again, works in kitchen, issues with live --- attributes/default.rb | 20 +++++++++++++------- metadata.rb | 2 +- templates/default/bareos-dir.conf.erb | 14 +++++++------- templates/default/client.conf.erb | 12 +++++++++++- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index ddb770f..8333321 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -58,6 +58,8 @@ default['bareos']['clients']['client_list'] = %w(node) # {'foo.bar.org','boo.ya.org'} default['bareos']['clients']['file_retention'] = '30 days' default['bareos']['clients']['job_retention'] = '6 months' +default]'bareos']['clients']['volume_retention'] = '6 months' +default]'bareos']['clients']['catalog_files'] = 'yes' default['bareos']['clients']['autoprune'] = 'yes' default['bareos']['clients']['heartbeat_interval'] = 600 default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' @@ -68,21 +70,25 @@ default['bareos']['clients']['jobdef_default_storage'] = 'File' default['bareos']['clients']['jobdef_default_fileset'] = "#{node['fqdn']}-Fileset" default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] +default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below -if node['bareos']['clients']['host_pools'] == true - default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" - default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" - default['bareos']['clients']['differential_pool'] = "#{node['fqdn']}-Diff-Pool" - default['bareos']['clients']['default_pool'] = "#{node['fqdn']}-Default-Pool" -else + +case node['bareos']['clients']['host_pools'] +when false default['bareos']['clients']['full_pool'] = 'File-Full-Pool' default['bareos']['clients']['incremental_pool'] = 'File-Inc-Pool' default['bareos']['clients']['differential_pool'] = 'File-Diff-Pool' default['bareos']['clients']['default_pool'] = 'File-Default-Pool' +when true + default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" + default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" + default['bareos']['clients']['differential_pool'] = "#{node['fqdn']}-Diff-Pool" + default['bareos']['clients']['default_pool'] = "#{node['fqdn']}-Default-Pool" end + default['bareos']['clients']['enable_vfulls'] = false -default['bareos']['clients']['vfull_pool'] = node['bareos']['clients']['full_pool'] +default['bareos']['clients']['vfull_pool'] = "#{node['fqdn']}-VFull-Pool" default['bareos']['clients']['vfull_priority'] = 9 default['bareos']['clients']['vfull_accurate'] = 'no' # More sane option is no, yes is preferred if possible default['bareos']['clients']['vfull_spool'] = 'no' # Not useful in most cases but available diff --git a/metadata.rb b/metadata.rb index 5058eef..98157a7 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.6' +version '1.1.7' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index cfa8863..a0bde43 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -159,9 +159,9 @@ Messages { catalog = all } -################# -# Default Pools # -################# +########################### +# Default File-Based Pools # +########################### Pool { Name = File-Default-Pool @@ -170,7 +170,7 @@ Pool { AutoPrune = yes Volume Retention = 30 days Maximum Volume Bytes = 10G - Maximum Volumes = 100 + Maximum Volumes = 25 LabelFormat = "FileDefaultVol-" } @@ -181,7 +181,7 @@ Pool { AutoPrune = yes Volume Retention = 6 months Maximum Volume Bytes = 10G - Maximum Volumes = 100 + Maximum Volumes = 25 LabelFormat = "FileFullVol-" } @@ -192,7 +192,7 @@ Pool { AutoPrune = yes Volume Retention = 2 months Maximum Volume Bytes = 10G - Maximum Volumes = 100 + Maximum Volumes = 25 LabelFormat = "FileIncVol-" } @@ -203,7 +203,7 @@ Pool { AutoPrune = yes Volume Retention = 4 months Maximum Volume Bytes = 10G - Maximum Volumes = 100 + Maximum Volumes = 25 LabelFormat = "FileDiffVol-" } diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index b7456d4..60d78ac 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -93,7 +93,7 @@ JobDefs { Schedule = "<%= @bareos_client['bareos']['clients']['vfull_schedule'] %>" Storage = <%= @bareos_client['bareos']['storage']['main_storage'] %> Messages = <%= node['bareos']['messages']['default_messages'] %> - Pool = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> + Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> @@ -113,6 +113,16 @@ Schedule { Name = <%= @bareos_client['bareos']['clients']['vfull_schedule'] %> Run = Level=VirtualFull on 1 at 3:00 } + +Pool { + Name = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> + Pool Type = Backup + Catalog Files = <%= @bareos_client['bareos']['clients']['catalog_files'] %> + AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> + Storage = <%= @bareos_client['bareos']['clients']['vfull_storage'] %> + Next Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + Volume Retention = <%= @bareos_client['bareos']['clients']['volume_retention'] %> +} <% end %> <% if @bareos_client['bareos']['clients']['host_pools'] %> From 248576505ec3274bafec15be4cb87c81e55aef61 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 8 Oct 2015 16:42:14 -0700 Subject: [PATCH 107/311] interesting --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8333321..cb44fea 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -58,8 +58,8 @@ default['bareos']['clients']['client_list'] = %w(node) # {'foo.bar.org','boo.ya.org'} default['bareos']['clients']['file_retention'] = '30 days' default['bareos']['clients']['job_retention'] = '6 months' -default]'bareos']['clients']['volume_retention'] = '6 months' -default]'bareos']['clients']['catalog_files'] = 'yes' +default['bareos']['clients']['volume_retention'] = '6 months' +default['bareos']['clients']['catalog_files'] = 'yes' default['bareos']['clients']['autoprune'] = 'yes' default['bareos']['clients']['heartbeat_interval'] = 600 default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' From 0267cb6bed651350740ea00464f3a1921d38a567 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 16 Oct 2015 12:19:24 -0700 Subject: [PATCH 108/311] reverting default pool names, possible collision with deep merging attributes --- metadata.rb | 2 +- templates/default/bareos-dir.conf.erb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/metadata.rb b/metadata.rb index 98157a7..d47cb70 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.7' +version '1.1.8' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index a0bde43..d7677c8 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -164,7 +164,7 @@ Messages { ########################### Pool { - Name = File-Default-Pool + Name = Default-Pool Pool Type = Backup Recycle = yes AutoPrune = yes @@ -175,7 +175,7 @@ Pool { } Pool { - Name = File-Full-Pool + Name = Full-Pool Pool Type = Backup Recycle = yes AutoPrune = yes @@ -186,7 +186,7 @@ Pool { } Pool { - Name = File-Inc-Pool + Name = Inc-Pool Pool Type = Backup Recycle = yes AutoPrune = yes @@ -197,7 +197,7 @@ Pool { } Pool { - Name = File-Diff-Pool + Name = Diff-Pool Pool Type = Backup Recycle = yes AutoPrune = yes From ebfa4f6b12339848e9a81124761513ad4e4c95c1 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 16 Oct 2015 14:59:46 -0700 Subject: [PATCH 109/311] aligning labels --- templates/default/bareos-dir.conf.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index d7677c8..6c628d8 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -171,7 +171,7 @@ Pool { Volume Retention = 30 days Maximum Volume Bytes = 10G Maximum Volumes = 25 - LabelFormat = "FileDefaultVol-" + LabelFormat = "DefaultVol-" } Pool { @@ -182,7 +182,7 @@ Pool { Volume Retention = 6 months Maximum Volume Bytes = 10G Maximum Volumes = 25 - LabelFormat = "FileFullVol-" + LabelFormat = "FullVol-" } Pool { @@ -193,7 +193,7 @@ Pool { Volume Retention = 2 months Maximum Volume Bytes = 10G Maximum Volumes = 25 - LabelFormat = "FileIncVol-" + LabelFormat = "IncVol-" } Pool { @@ -204,7 +204,7 @@ Pool { Volume Retention = 4 months Maximum Volume Bytes = 10G Maximum Volumes = 25 - LabelFormat = "FileDiffVol-" + LabelFormat = "DiffVol-" } Pool { From 0e4f2d6264a6e8366203d02068ef3211dc983309 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 16 Oct 2015 15:00:17 -0700 Subject: [PATCH 110/311] bump for volume naming change --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index d47cb70..50f1913 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.8' +version '1.1.9' %w( centos redhat ).each do |os| supports os, '>= 6.0' From e0056bc709ab0479f9367c1cfc0453f712be5cf8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 16 Oct 2015 15:02:27 -0700 Subject: [PATCH 111/311] needed to change this --- attributes/default.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index cb44fea..589bccf 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -76,10 +76,10 @@ case node['bareos']['clients']['host_pools'] when false - default['bareos']['clients']['full_pool'] = 'File-Full-Pool' - default['bareos']['clients']['incremental_pool'] = 'File-Inc-Pool' - default['bareos']['clients']['differential_pool'] = 'File-Diff-Pool' - default['bareos']['clients']['default_pool'] = 'File-Default-Pool' + default['bareos']['clients']['full_pool'] = 'Full-Pool' + default['bareos']['clients']['incremental_pool'] = 'Inc-Pool' + default['bareos']['clients']['differential_pool'] = 'Diff-Pool' + default['bareos']['clients']['default_pool'] = 'Default-Pool' when true default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" From 534c6de4533f27d192d26ef81424785263a76bb5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 20 Oct 2015 22:51:44 -0700 Subject: [PATCH 112/311] Trying to make cookbook more general/dynamic --- attributes/default.rb | 2 +- recipes/server.rb | 44 ++++----- templates/default/bareos-dir.conf.erb | 77 ---------------- templates/default/client.conf.erb | 40 +------- templates/default/clients.conf.erb | 126 ++++++++++++++++++++++++++ templates/default/pools.conf.erb | 19 ++++ 6 files changed, 171 insertions(+), 137 deletions(-) create mode 100644 templates/default/clients.conf.erb create mode 100644 templates/default/pools.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index 589bccf..76ab6ef 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -72,8 +72,8 @@ default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] -default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below +default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below case node['bareos']['clients']['host_pools'] when false default['bareos']['clients']['full_pool'] = 'Full-Pool' diff --git a/recipes/server.rb b/recipes/server.rb index dd3c91b..a2844b0 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -31,16 +31,8 @@ end end -# Create hosts directory for host configs -directory '/etc/bareos/bareos-dir.d/clients/' do - owner 'root' - group 'root' - mode '0755' - action :create -end - # Create a placeholder file so BAREOS doesn't throw error when none found -file '/etc/bareos/bareos-dir.d/_recipe_complete.conf' do +file '/etc/bareos/bareos-dir.d/.conf' do content '# This is a base file so the recipe works with no additional help' owner 'root' group 'root' @@ -75,19 +67,27 @@ bareos_clients = search(:node, 'roles:bareos_client') end -# Account for any number of clients, setup the client config on the director machine -# Also push out whether to do custom client pools in chef-solo or chef-client mode -bareos_clients.each do |client| - template "/etc/bareos/bareos-dir.d/clients/#{client['fqdn']}.conf" do - source 'client.conf.erb' - owner 'bareos' - group 'bareos' - mode '0640' - variables( - bareos_client: client - ) - notifies :run, 'execute[reload-dir]', :delayed - end +template "/etc/bareos/bareos-dir.d/clients.conf" do + source 'clients.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: bareos_clients, + ) + notifies :run, 'execute[reload-dir]', :delayed +end + +# Populate pools config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/pools.conf' do + source 'pools.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + client_pools: node['bareos']['clients']['pools'] + ) + notifies :run, 'execute[reload-dir]', :delayed end # Allow a restart of the director daemon if called with tests up front diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 6c628d8..f00f7ab 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -71,25 +71,6 @@ FileSet { } } -# Example for windows machine filesets # -# FileSet { -# Name = "Windows All Drives" -# Enable VSS = yes -# Include { -# Options { -# Signature = MD5 -# Drive Type = fixed -# IgnoreCase = yes -# WildFile = "[A-Z]:/pagefile.sys" -# WildDir = "[A-Z]:/RECYCLER" -# WildDir = "[A-Z]:/$RECYCLE.BIN" -# WildDir = "[A-Z]:/System Volume Information" -# Exclude = yes -# } -# File = / -# } -# } - ##################### # Default Schedules # ##################### @@ -159,67 +140,9 @@ Messages { catalog = all } -########################### -# Default File-Based Pools # -########################### - -Pool { - Name = Default-Pool - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 30 days - Maximum Volume Bytes = 10G - Maximum Volumes = 25 - LabelFormat = "DefaultVol-" -} - -Pool { - Name = Full-Pool - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 6 months - Maximum Volume Bytes = 10G - Maximum Volumes = 25 - LabelFormat = "FullVol-" -} - -Pool { - Name = Inc-Pool - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 2 months - Maximum Volume Bytes = 10G - Maximum Volumes = 25 - LabelFormat = "IncVol-" -} - -Pool { - Name = Diff-Pool - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 4 months - Maximum Volume Bytes = 10G - Maximum Volumes = 25 - LabelFormat = "DiffVol-" -} - -Pool { - Name = Scratch - Pool Type = Backup -} -<% if node['bareos']['director']['custom_configs'] %> - ########################################### # Custom Director Daemon Config Locations # ########################################### # General @|"sh -c 'for conf in /etc/bareos/bareos-dir.d/*.conf ; do echo @${conf} ; done'" - -# Clients -@|"sh -c 'for clients in /etc/bareos/bareos-dir.d/clients/*.conf ; do echo @${clients} ; done'" -<% end %> diff --git a/templates/default/client.conf.erb b/templates/default/client.conf.erb index 60d78ac..8d5b0af 100644 --- a/templates/default/client.conf.erb +++ b/templates/default/client.conf.erb @@ -3,7 +3,7 @@ # Local modifications will be overwritten. # # Bareos Client Configuration File - +<% @bareos_client.each do |client| %> Client { Name = <%= @bareos_client['fqdn'] %>-fd Address = <%= @bareos_client['fqdn'] %> @@ -76,8 +76,9 @@ FileSet { <% if @bareos_client['bareos']['clients']['enable_vfulls'] %> # VirtualFull Job +<% @client_vfulljob.each do |vjob_name, vjob| %> Job { - Name = "<%= @bareos_client['fqdn'] %>-VFullJob" + Name = "<%= vjob_name %>" Client = <%= @bareos_client['fqdn'] %>-fd JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" @@ -124,38 +125,3 @@ Pool { Volume Retention = <%= @bareos_client['bareos']['clients']['volume_retention'] %> } <% end %> - -<% if @bareos_client['bareos']['clients']['host_pools'] %> -# Individual host pools for better tape library/storage utilization -Pool { - Name = <%= @bareos_client['bareos']['clients']['default_pool'] %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 7 days -} - -Pool { - Name = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 1 year -} - -Pool { - Name = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 30 days -} - -Pool { - Name = <%= @bareos_client['bareos']['clients']['differential_pool'] %> - Pool Type = Backup - Recycle = yes - AutoPrune = yes - Volume Retention = 3 months -} -<% end %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb new file mode 100644 index 0000000..e506c90 --- /dev/null +++ b/templates/default/clients.conf.erb @@ -0,0 +1,126 @@ +<%# BAREOS CLIENT TEMPLATE %> +# Generated by Chef for <%= @bareos_client['fqdn'] %>-fd +# Local modifications will be overwritten. +# +# Bareos Client Configuration File + +Client { + Name = <%= @bareos_client['fqdn'] %>-fd + Address = <%= @bareos_client['fqdn'] %> + FDPort = <%= @bareos_client['bareos']['clients']['fd_port'] %> + Catalog = <%= node['bareos']['database']['catalog_name'] %> + Password = "<%= @bareos_client['bareos']['fd_password'] %>" # password for FileDaemon + File Retention = <%= @bareos_client['bareos']['clients']['file_retention'] %> + Job Retention = <%= @bareos_client['bareos']['clients']['job_retention'] %> + AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> + Maximum Concurrent Jobs = <%= @bareos_client['bareos']['clients']['max_concurrent_jobs'] %> +} + +JobDefs { + Name = "<%= @bareos_client['fqdn'] %>-JobDef" + Type = Backup + Level = Incremental + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" + Schedule = "<%= @bareos_client['bareos']['clients']['jobdef_default_schedule'] %>" + Storage = <%= @bareos_client['bareos']['clients']['jobdef_default_storage'] %> + Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> + Pool = <%= @bareos_client['bareos']['clients']['default_pool'] %> + FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> + Priority = <%= @bareos_client['bareos']['clients']['jobdef_default_runlevel'] %> + Write Bootstrap = "/var/lib/bareos/%c.bsr" + SpoolData = <%= @bareos_client['bareos']['clients']['spool_data'] %> +} + +# Default Job +Job { + Name = "<%= @bareos_client['fqdn'] %>-Job" + JobDefs = "<%= @bareos_client['fqdn'] %>-JobDef" +} + +# Restore Job +Job { + Name = "<%= @bareos_client['fqdn'] %>-Restore" + Type = Restore + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" + Storage = <%= @bareos_client['bareos']['clients']['storage'] %> + Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + Messages = <%= node['bareos']['messages']['default_messages'] %> + Where = /tmp/<%= @bareos_client['fqdn'] %>_restored/ +} + +FileSet { + Name = "<%= @bareos_client['fqdn'] %>-Fileset" + Include { + Options { + signature = MD5 + } + File = / + Exclude Dir Containing = .bareos_ignore + } + Exclude { + File = /var/lib/bareos + File = /var/lib/bareos/storage + File = /var/lib/pgsql + File = /var/lib/mysql + File = /proc + File = /tmp + File = /.journal + File = /.fsck + File = /spool + } +} + +<% if @bareos_client['bareos']['clients']['enable_vfulls'] %> +# VirtualFull Job +Job { + Name = "<%= @bareos_client['fqdn'] %>-VFullJob" + Client = <%= @bareos_client['fqdn'] %>-fd + JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" + Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> +} + +JobDefs { + Name = "<%= @bareos_client['fqdn'] %>-VFullJobDef" + Type = Backup + Level = VirtualFull + Client = <%= @bareos_client['fqdn'] %>-fd + FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" + Schedule = "<%= @bareos_client['bareos']['clients']['vfull_schedule'] %>" + Storage = <%= @bareos_client['bareos']['storage']['main_storage'] %> + Messages = <%= node['bareos']['messages']['default_messages'] %> + Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> + DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> + FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + Priority = <%= node['bareos']['clients']['vfull_priority'] %> + Write Bootstrap = "<%= node['bareos']['clients']['bootstrap_file'] %>" + SpoolData = <%= @bareos_client['bareos']['clients']['vfull_spool'] %> + Maximum Concurrent Jobs = <%= node['bareos']['clients']['vfull_concurrent_jobs'] %> + Allow Duplicate Jobs = <%= node['bareos']['clients']['vfull_duplicate_jobs'] %> + Cancel Lower Level Duplicates = <%= node['bareos']['clients']['vfull_cancel_low_duplicates'] %> + Reschedule On Error = <%= node['bareos']['clients']['vfull_reschedule_on_fail'] %> + Reschedule Interval = <%= node['bareos']['clients']['vfull_reschedule_interval'] %> + Reschedule Times = <%= node['bareos']['clients']['vfull_reschedule_times'] %> + Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> +} + +Schedule { + Name = <%= @bareos_client['bareos']['clients']['vfull_schedule'] %> + Run = Level=VirtualFull on 1 at 3:00 +} + +Pool { + Name = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> + Pool Type = Backup + Catalog Files = <%= @bareos_client['bareos']['clients']['catalog_files'] %> + AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> + Storage = <%= @bareos_client['bareos']['clients']['vfull_storage'] %> + Next Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> + Volume Retention = <%= @bareos_client['bareos']['clients']['volume_retention'] %> +} +<% end %> diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb new file mode 100644 index 0000000..6ce1118 --- /dev/null +++ b/templates/default/pools.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS POOLS DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @client_pools.each do |pool_name, pool| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> From a9decc4efe38db532508ab72f806b665a43f7dc6 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 20 Oct 2015 23:35:52 -0700 Subject: [PATCH 113/311] reducing necessary attributes --- attributes/default.rb | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 76ab6ef..05281ba 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -73,22 +73,8 @@ default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] -default['bareos']['clients']['host_pools'] = false # Default is disabled, normal pools, see below -case node['bareos']['clients']['host_pools'] -when false - default['bareos']['clients']['full_pool'] = 'Full-Pool' - default['bareos']['clients']['incremental_pool'] = 'Inc-Pool' - default['bareos']['clients']['differential_pool'] = 'Diff-Pool' - default['bareos']['clients']['default_pool'] = 'Default-Pool' -when true - default['bareos']['clients']['full_pool'] = "#{node['fqdn']}-Full-Pool" - default['bareos']['clients']['incremental_pool'] = "#{node['fqdn']}-Inc-Pool" - default['bareos']['clients']['differential_pool'] = "#{node['fqdn']}-Diff-Pool" - default['bareos']['clients']['default_pool'] = "#{node['fqdn']}-Default-Pool" -end default['bareos']['clients']['enable_vfulls'] = false -default['bareos']['clients']['vfull_pool'] = "#{node['fqdn']}-VFull-Pool" default['bareos']['clients']['vfull_priority'] = 9 default['bareos']['clients']['vfull_accurate'] = 'no' # More sane option is no, yes is preferred if possible default['bareos']['clients']['vfull_spool'] = 'no' # Not useful in most cases but available @@ -100,15 +86,25 @@ default['bareos']['clients']['vfull_reschedule_interval'] = '30 minutes' default['bareos']['clients']['vfull_reschedule_times'] = 1 +default['bareos']['clients']['vfull']["#{}"] = { + '' => '', + '' => '' +} + +# Pools - You have the power, here is an example for default pool only +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + # Storage Daemon default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks -case node['bareos']['storage']['tape'] -when true - default['bareos']['storage']['main_storage'] = 'TapeLibrary' # When enabled change to appropriate label in wrapper -when false - default['bareos']['storage']['main_storage'] = 'File' -end +default['bareos']['storage']['main_storage'] = 'File' default['bareos']['storage']['servers'] = {} # Use FQDN of each server for consistancy in solo mode default['bareos']['storage']['custom_configs'] = '0' default['bareos']['storage']['sd_mon_enable'] = 'yes' From d1c449f6b08281de7b960f5d6497bbdfbf5836cb Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 23 Oct 2015 13:17:13 -0700 Subject: [PATCH 114/311] rearchitecting cookbook to use hases, still work to be done on this --- .../default => attributes}/client.conf.erb | 0 attributes/default.rb | 74 ++++++++++-- recipes/client.rb | 2 +- recipes/server.rb | 94 ++++++++++++--- recipes/storage.rb | 5 +- recipes/workstation.rb | 17 ++- templates/default/bconsole.conf.erb | 14 +-- templates/default/clients.conf.erb | 113 ++---------------- templates/default/filesets.conf.erb | 19 +++ templates/default/job_definitions.conf.erb | 19 +++ templates/default/jobs.conf.erb | 19 +++ templates/default/schedules.conf.erb | 19 +++ templates/default/storages.conf.erb | 19 +++ 13 files changed, 261 insertions(+), 153 deletions(-) rename {templates/default => attributes}/client.conf.erb (100%) create mode 100644 templates/default/filesets.conf.erb create mode 100644 templates/default/job_definitions.conf.erb create mode 100644 templates/default/jobs.conf.erb create mode 100644 templates/default/schedules.conf.erb create mode 100644 templates/default/storages.conf.erb diff --git a/templates/default/client.conf.erb b/attributes/client.conf.erb similarity index 100% rename from templates/default/client.conf.erb rename to attributes/client.conf.erb diff --git a/attributes/default.rb b/attributes/default.rb index 05281ba..bbba99a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -53,9 +53,10 @@ default['bareos']['database']['dbaddress'] = nil # Clients +default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 -default['bareos']['clients']['client_list'] = %w(node) # {'foo.bar.org','boo.ya.org'} +default['bareos']['clients']['client_list'] = %w(node) default['bareos']['clients']['file_retention'] = '30 days' default['bareos']['clients']['job_retention'] = '6 months' default['bareos']['clients']['volume_retention'] = '6 months' @@ -91,6 +92,46 @@ '' => '' } +# Clients Definitions - You have the power, here is an example for a default definition +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + +# Job Definitions - You have the power, here is an example for a default definition +default['bareos']['clients']['job_definitions']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + +# Job Definitions - You have the power, here is an example for a default definition +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + +# Filesets - You have the power, here is an example for a default definition +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + # Pools - You have the power, here is an example for default pool only default['bareos']['clients']['pools']['default'] = { 'Pool Type' => 'Backup', @@ -101,26 +142,43 @@ 'LabelFormat' => 'FileVolume-' } +# Schedules - You have the power, here is an example for a default definition +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + +# Storages - You have the power, here is an example for a default definition +default['bareos']['clients']['pools']['default'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25' + 'LabelFormat' => 'FileVolume-' +} + # Storage Daemon +default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks default['bareos']['storage']['main_storage'] = 'File' -default['bareos']['storage']['servers'] = {} # Use FQDN of each server for consistancy in solo mode -default['bareos']['storage']['custom_configs'] = '0' +default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 # Director +default['bareos']['director']['dir_search_query'] = 'role:bareos_server' default['bareos']['director']['dir_port'] = 9101 default['bareos']['director']['dir_max_concurrent_jobs'] = 20 -default['bareos']['director']['custom_configs'] = true -default['bareos']['director']['servers'] = {} # Use FQDN of each server for consistancy in solo mode +default['bareos']['director']['servers'] = %w(node) default['bareos']['director']['console_commandacl'] = 'status, .status' default['bareos']['director']['heartbeat_interval'] = 600 # Subscription Management (Director) default['bareos']['director']['dir_subscription'] = nil default['bareos']['director']['dir_subs'] = nil - -# Workstation -default['bareos']['workstation']['solo_mode'] = '0' diff --git a/recipes/client.rb b/recipes/client.rb index 9062d48..30b0e3b 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -30,7 +30,7 @@ if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, 'roles:bareos_director') + bareos_dir = search(:node, "#{node['bareos']['dir_search_query']}") end # Setup the configs for any local/remote File Daemons clients diff --git a/recipes/server.rb b/recipes/server.rb index a2844b0..c74bfe5 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -31,16 +31,14 @@ end end -# Create a placeholder file so BAREOS doesn't throw error when none found -file '/etc/bareos/bareos-dir.d/.conf' do - content '# This is a base file so the recipe works with no additional help' - owner 'root' - group 'root' - mode '0755' - action :create +# Create a blank placeholder for d directory +execute 'director_conf_holder' do + command 'touch /etc/bareos/bareos-dir.d/.conf' + creates '/etc/bareos/bareos-dir.d/.conf' + action :run end -# Create necessary bareos-dir config +# Create the base config for the Bareos Director template '/etc/bareos/bareos-dir.conf' do source 'bareos-dir.conf.erb' owner 'bareos' @@ -56,40 +54,104 @@ notifies :run, 'execute[reload-dir]', :delayed end -# Handle seperate host config files -# Populate host config files based on: -# * the default['bareos']['clients']['client_list'] attribute -# - OR - -# * hosts with bareos_client role attached +# Create clients config based on sets of hashes, see attributes file for example if Chef::Config[:solo] bareos_clients = node['bareos']['clients']['client_list'] else - bareos_clients = search(:node, 'roles:bareos_client') + bareos_clients = search(:node, "#{node['bareos']['clients']['client_search_query']}") end -template "/etc/bareos/bareos-dir.d/clients.conf" do +template '/etc/bareos/bareos-dir.d/clients.conf' do source 'clients.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( bareos_client: bareos_clients, + client_pools: node['bareos']['clients']['definition'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Populate pools config based on sets of hashes, see attributes file for example +# Create jobs config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/jobs.conf' do + source 'jobs.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: bareos_clients, + client_jobs: node['bareos']['clients']['jobs'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + +# Create job definitions config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/job_definitions.conf' do + source 'job_definitions.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: bareos_clients, + job_definitions: node['bareos']['clients']['job_definitions'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + +# Create filesets config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/filesets.conf' do + source 'filesets.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: bareos_clients, + fileset_options: node['baroes']['clients']['filesets']['options'], + fileset_include_files: node['bareos']['clients']['filesets']['include'], + fileset_exclude_files: node['bareos']['clients']['filesets']['exclude'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + +# Create pools config based on sets of hashes, see attributes file for example template '/etc/bareos/bareos-dir.d/pools.conf' do source 'pools.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( + bareos_client: bareos_clients, client_pools: node['bareos']['clients']['pools'] ) notifies :run, 'execute[reload-dir]', :delayed end +# Create schedules config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/schedules.conf' do + source 'filesets.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + bareos_client: bareos_clients, + client_schedules: node['bareos']['clients']['schedules'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + +# Create storages config based on sets of hashes, see attributes file for example +template '/etc/bareos/bareos-dir.d/storages.conf' do + source 'storages.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + director_storages: node['bareos']['director']['storages'] + ) + notifies :run, 'execute[reload-dir]', :delayed +end + # Allow a restart of the director daemon if called with tests up front execute 'reload-dir' do command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' diff --git a/recipes/storage.rb b/recipes/storage.rb index d9e03df..a3f5cf9 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -43,8 +43,8 @@ bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] else - bareos_sd = search(:node, 'roles:bareos_storage') - bareos_dir = search(:node, 'roles:bareos_director') + bareos_sd = search(:node, "#{node['bareos']['storage']['storage_search_query']}") + bareos_dir = search(:node, "#{node['bareos']['director']['dir_search_query']}") end # Setup the bareos-sd config @@ -67,7 +67,6 @@ mode '0755' action :create notifies :run, 'execute[restart-sd]', :delayed - only_if node['bareos']['storage']['custom_configs'] == '1' end # If called restart the bareos-sd confg(s) with a test first diff --git a/recipes/workstation.rb b/recipes/workstation.rb index e674874..3cb848f 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -27,9 +27,8 @@ # Define the list of bareos directors if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] - node.default['bareos']['workstation']['solo_mode'] = '1' else - bareos_dir = search(:node, 'roles:bareos_director') + bareos_dir = search(:node, "#{node['bareos']['director']['dir_search_query']}") end # Setup the bconsole config, pushes out list of bareos-dirs and if solo mode @@ -38,8 +37,14 @@ mode 0640 owner 'bareos' group 'bareos' - variables( - bareos_dir: bareos_dir, - solo_mode: node['bareos']['workstation']['solo_mode'] - ) + if Chef::Config[:solo] + variables( + bareos_dir: bareos_dir, + solo_mode: Chef::Config[:solo] + ) + else + variables( + bareos_dir: bareos_dir + ) + end end diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index 515c7c5..e1c9a2e 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -4,23 +4,11 @@ # # Bareos User Agent (or Console) Configuration File -<% if @solo_mode == '1' %> - <% @bareos_dir.each do |director| %> -Director { - Name = <%= director %>-dir - DIRport = <%= node['bareos']['director']['dir_port'] %> - address = <%= director %> - Password = "<%= node['bareos']['dir_password'] %>" -} - <% end %> -<% else %> - <%# @bareos_dir_hostname.zip(@bareos_dir_fqdn).each do |hostname, fqdn| %> - <% @bareos_dir.each do |director| %> +<% @bareos_dir.each do |director| %> Director { Name = <%= director['fqdn'] %>-dir DIRport = <%= node['bareos']['director']['dir_port'] %> address = <%= director['fqdn'] %> Password = "<%= node['bareos']['dir_password'] %>" } - <% end %> <% end %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index e506c90..3c315e5 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -16,111 +16,12 @@ Client { Maximum Concurrent Jobs = <%= @bareos_client['bareos']['clients']['max_concurrent_jobs'] %> } -JobDefs { - Name = "<%= @bareos_client['fqdn'] %>-JobDef" - Type = Backup - Level = Incremental - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= @bareos_client['bareos']['clients']['jobdef_default_schedule'] %>" - Storage = <%= @bareos_client['bareos']['clients']['jobdef_default_storage'] %> - Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> - Pool = <%= @bareos_client['bareos']['clients']['default_pool'] %> - FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> - Priority = <%= @bareos_client['bareos']['clients']['jobdef_default_runlevel'] %> - Write Bootstrap = "/var/lib/bareos/%c.bsr" - SpoolData = <%= @bareos_client['bareos']['clients']['spool_data'] %> -} - -# Default Job -Job { - Name = "<%= @bareos_client['fqdn'] %>-Job" - JobDefs = "<%= @bareos_client['fqdn'] %>-JobDef" -} - -# Restore Job -Job { - Name = "<%= @bareos_client['fqdn'] %>-Restore" - Type = Restore - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Storage = <%= @bareos_client['bareos']['clients']['storage'] %> - Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Messages = <%= node['bareos']['messages']['default_messages'] %> - Where = /tmp/<%= @bareos_client['fqdn'] %>_restored/ -} - -FileSet { - Name = "<%= @bareos_client['fqdn'] %>-Fileset" - Include { - Options { - signature = MD5 - } - File = / - Exclude Dir Containing = .bareos_ignore - } - Exclude { - File = /var/lib/bareos - File = /var/lib/bareos/storage - File = /var/lib/pgsql - File = /var/lib/mysql - File = /proc - File = /tmp - File = /.journal - File = /.fsck - File = /spool - } -} - -<% if @bareos_client['bareos']['clients']['enable_vfulls'] %> -# VirtualFull Job -Job { - Name = "<%= @bareos_client['fqdn'] %>-VFullJob" - Client = <%= @bareos_client['fqdn'] %>-fd - JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> -} - -JobDefs { - Name = "<%= @bareos_client['fqdn'] %>-VFullJobDef" - Type = Backup - Level = VirtualFull - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= @bareos_client['bareos']['clients']['vfull_schedule'] %>" - Storage = <%= @bareos_client['bareos']['storage']['main_storage'] %> - Messages = <%= node['bareos']['messages']['default_messages'] %> - Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> - FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Priority = <%= node['bareos']['clients']['vfull_priority'] %> - Write Bootstrap = "<%= node['bareos']['clients']['bootstrap_file'] %>" - SpoolData = <%= @bareos_client['bareos']['clients']['vfull_spool'] %> - Maximum Concurrent Jobs = <%= node['bareos']['clients']['vfull_concurrent_jobs'] %> - Allow Duplicate Jobs = <%= node['bareos']['clients']['vfull_duplicate_jobs'] %> - Cancel Lower Level Duplicates = <%= node['bareos']['clients']['vfull_cancel_low_duplicates'] %> - Reschedule On Error = <%= node['bareos']['clients']['vfull_reschedule_on_fail'] %> - Reschedule Interval = <%= node['bareos']['clients']['vfull_reschedule_interval'] %> - Reschedule Times = <%= node['bareos']['clients']['vfull_reschedule_times'] %> - Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> -} - -Schedule { - Name = <%= @bareos_client['bareos']['clients']['vfull_schedule'] %> - Run = Level=VirtualFull on 1 at 3:00 +<% @bareos_clients.each do |client| %> +Client { +<% @client_config.each do | + Name = <%= client_name %> +<% client.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> } - -Pool { - Name = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> - Pool Type = Backup - Catalog Files = <%= @bareos_client['bareos']['clients']['catalog_files'] %> - AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> - Storage = <%= @bareos_client['bareos']['clients']['vfull_storage'] %> - Next Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Volume Retention = <%= @bareos_client['bareos']['clients']['volume_retention'] %> -} <% end %> diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb new file mode 100644 index 0000000..8aab076 --- /dev/null +++ b/templates/default/filesets.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS FILESET DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @bareos_clients.each do |fileset_name, fileset| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb new file mode 100644 index 0000000..6ce1118 --- /dev/null +++ b/templates/default/job_definitions.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS POOLS DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @client_pools.each do |pool_name, pool| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb new file mode 100644 index 0000000..6ce1118 --- /dev/null +++ b/templates/default/jobs.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS POOLS DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @client_pools.each do |pool_name, pool| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> diff --git a/templates/default/schedules.conf.erb b/templates/default/schedules.conf.erb new file mode 100644 index 0000000..6ce1118 --- /dev/null +++ b/templates/default/schedules.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS POOLS DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @client_pools.each do |pool_name, pool| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> diff --git a/templates/default/storages.conf.erb b/templates/default/storages.conf.erb new file mode 100644 index 0000000..6ce1118 --- /dev/null +++ b/templates/default/storages.conf.erb @@ -0,0 +1,19 @@ +<%# BAREOS POOLS DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['fqdn'] %>-dir +# Local modifications will be overwritten. +# +# Bareos Pool Definition File + +<%-%> +<%# Here is an example attribute that will populate pools %> +<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> +<%-%> + +<% @client_pools.each do |pool_name, pool| %> +Pool { + Name = <%= pool_name %> +<% pool.each do |key,value| %> +<%= key %> = <%= value %> +<% end %> +} +<% end %> From ec53e6cd7d6a4d20f5e691abb84ee995c85d9e4e Mon Sep 17 00:00:00 2001 From: The Gitter Badger Date: Sun, 25 Oct 2015 00:21:34 +0000 Subject: [PATCH 115/311] Add Gitter badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f16accd..071de72 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ Chef-Bareos Cookbook ==================== +[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) This cookbook installs and configures backups based on [Bareos](https://www.bareos.org/en/). From a4fed7a7cc5c6927996d080eb1b18fab7988f6f4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 29 Oct 2015 09:24:06 -0700 Subject: [PATCH 116/311] starting on a skeleton hashing framework --- attributes/default.rb | 22 +++++++------------ metadata.rb | 2 +- recipes/server.rb | 6 +++--- recipes/workstation.rb | 2 +- templates/default/bconsole.conf.erb | 8 +++---- templates/default/clients.conf.erb | 33 +++++++++++++---------------- 6 files changed, 32 insertions(+), 41 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index bbba99a..0900d66 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,7 +74,6 @@ default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] - default['bareos']['clients']['enable_vfulls'] = false default['bareos']['clients']['vfull_priority'] = 9 default['bareos']['clients']['vfull_accurate'] = 'no' # More sane option is no, yes is preferred if possible @@ -87,28 +86,23 @@ default['bareos']['clients']['vfull_reschedule_interval'] = '30 minutes' default['bareos']['clients']['vfull_reschedule_times'] = 1 -default['bareos']['clients']['vfull']["#{}"] = { - '' => '', - '' => '' -} - # Clients Definitions - You have the power, here is an example for a default definition default['bareos']['clients']['pools']['default'] = { 'Pool Type' => 'Backup', 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } -# Job Definitions - You have the power, here is an example for a default definition +# Jobs - You have the power, here is an example for a default definition default['bareos']['clients']['job_definitions']['default'] = { 'Pool Type' => 'Backup', 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } @@ -118,7 +112,7 @@ 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } @@ -128,7 +122,7 @@ 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } @@ -138,7 +132,7 @@ 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } @@ -148,7 +142,7 @@ 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } @@ -158,7 +152,7 @@ 'Recycle' => 'yes', 'Volume Retention' => '30 days', 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25' + 'Maximum Volumes' => '25', 'LabelFormat' => 'FileVolume-' } diff --git a/metadata.rb b/metadata.rb index 50f1913..695549a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.9' +version '2.0.0' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index c74bfe5..a4224ad 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -67,8 +67,8 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, - client_pools: node['bareos']['clients']['definition'] + bareos_client: bareos_clients + clients: bareos_clients ) notifies :run, 'execute[reload-dir]', :delayed end @@ -129,7 +129,7 @@ # Create schedules config based on sets of hashes, see attributes file for example template '/etc/bareos/bareos-dir.d/schedules.conf' do - source 'filesets.conf.erb' + source 'schedules.conf.erb' owner 'bareos' group 'bareos' mode '0640' diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 3cb848f..1223266 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -40,7 +40,7 @@ if Chef::Config[:solo] variables( bareos_dir: bareos_dir, - solo_mode: Chef::Config[:solo] + solo_mode: Chef::Config[:solo] ) else variables( diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index e1c9a2e..fd54dc1 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -6,9 +6,9 @@ <% @bareos_dir.each do |director| %> Director { - Name = <%= director['fqdn'] %>-dir - DIRport = <%= node['bareos']['director']['dir_port'] %> - address = <%= director['fqdn'] %> - Password = "<%= node['bareos']['dir_password'] %>" + Name = <%= director['bareos']['workstation']['name'] %>-dir + DIRport = <%= director['bareos']['director']['dir_port'] %> + address = <%= director['bareos']['workstation']['name'] %> + Password = "<%= director['bareos']['dir_password'] %>" } <% end %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 3c315e5..3171fea 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -4,24 +4,21 @@ # # Bareos Client Configuration File +# Borrowed some logic from the Nagios Cookbook +<% @clients.each do |client| %> Client { - Name = <%= @bareos_client['fqdn'] %>-fd - Address = <%= @bareos_client['fqdn'] %> - FDPort = <%= @bareos_client['bareos']['clients']['fd_port'] %> - Catalog = <%= node['bareos']['database']['catalog_name'] %> - Password = "<%= @bareos_client['bareos']['fd_password'] %>" # password for FileDaemon - File Retention = <%= @bareos_client['bareos']['clients']['file_retention'] %> - Job Retention = <%= @bareos_client['bareos']['clients']['job_retention'] %> - AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> - Maximum Concurrent Jobs = <%= @bareos_client['bareos']['clients']['max_concurrent_jobs'] %> -} - -<% @bareos_clients.each do |client| %> -Client { -<% @client_config.each do | - Name = <%= client_name %> -<% client.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> + Name = <%= client['bareos']['clients']['name'] %> + <% @client.each do |key,items| %> + <% case items %> + <% when String %> +<%= key + '=' + items %> + <% when Fixnum %> +<%= key + '=' + items.to_s %> + <% when Array %> + <% items.each do |item| %> +<%= key + '=' + item %> + <% end %> + <% end %> + <% end %> } <% end %> From 1c55e2e80d1b63156569772b2de2bf14b5a889cf Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 29 Oct 2015 14:53:06 -0700 Subject: [PATCH 117/311] rubocop cleanup --- recipes/client.rb | 2 +- recipes/server.rb | 4 ++-- recipes/storage.rb | 4 ++-- recipes/workstation.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/recipes/client.rb b/recipes/client.rb index 30b0e3b..a9e7762 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -30,7 +30,7 @@ if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, "#{node['bareos']['dir_search_query']}") + bareos_dir = search(:node, node['bareos']['dir_search_query']) end # Setup the configs for any local/remote File Daemons clients diff --git a/recipes/server.rb b/recipes/server.rb index a4224ad..97c3f98 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -58,7 +58,7 @@ if Chef::Config[:solo] bareos_clients = node['bareos']['clients']['client_list'] else - bareos_clients = search(:node, "#{node['bareos']['clients']['client_search_query']}") + bareos_clients = search(:node, node['bareos']['clients']['client_search_query']) end template '/etc/bareos/bareos-dir.d/clients.conf' do @@ -67,7 +67,7 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients + bareos_client: bareos_clients, clients: bareos_clients ) notifies :run, 'execute[reload-dir]', :delayed diff --git a/recipes/storage.rb b/recipes/storage.rb index a3f5cf9..4e5f561 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -43,8 +43,8 @@ bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] else - bareos_sd = search(:node, "#{node['bareos']['storage']['storage_search_query']}") - bareos_dir = search(:node, "#{node['bareos']['director']['dir_search_query']}") + bareos_sd = search(:node, node['bareos']['storage']['storage_search_query']) + bareos_dir = search(:node, node['bareos']['director']['dir_search_query']) end # Setup the bareos-sd config diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 1223266..564bfa7 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -28,7 +28,7 @@ if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, "#{node['bareos']['director']['dir_search_query']}") + bareos_dir = search(:node, node['bareos']['director']['dir_search_query']) end # Setup the bconsole config, pushes out list of bareos-dirs and if solo mode From 3a2d035693e1645fbd81c187b5934ba8cc55a6ce Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 29 Oct 2015 14:59:15 -0700 Subject: [PATCH 118/311] misplaced, removing --- attributes/client.conf.erb | 127 ------------------------------------- 1 file changed, 127 deletions(-) delete mode 100644 attributes/client.conf.erb diff --git a/attributes/client.conf.erb b/attributes/client.conf.erb deleted file mode 100644 index 8d5b0af..0000000 --- a/attributes/client.conf.erb +++ /dev/null @@ -1,127 +0,0 @@ -<%# BAREOS CLIENT TEMPLATE %> -# Generated by Chef for <%= @bareos_client['fqdn'] %>-fd -# Local modifications will be overwritten. -# -# Bareos Client Configuration File -<% @bareos_client.each do |client| %> -Client { - Name = <%= @bareos_client['fqdn'] %>-fd - Address = <%= @bareos_client['fqdn'] %> - FDPort = <%= @bareos_client['bareos']['clients']['fd_port'] %> - Catalog = <%= node['bareos']['database']['catalog_name'] %> - Password = "<%= @bareos_client['bareos']['fd_password'] %>" # password for FileDaemon - File Retention = <%= @bareos_client['bareos']['clients']['file_retention'] %> - Job Retention = <%= @bareos_client['bareos']['clients']['job_retention'] %> - AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> - Maximum Concurrent Jobs = <%= @bareos_client['bareos']['clients']['max_concurrent_jobs'] %> -} - -JobDefs { - Name = "<%= @bareos_client['fqdn'] %>-JobDef" - Type = Backup - Level = Incremental - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= @bareos_client['bareos']['clients']['jobdef_default_schedule'] %>" - Storage = <%= @bareos_client['bareos']['clients']['jobdef_default_storage'] %> - Messages = <%= node['bareos']['clients']['jobdef_default_messages'] %> - Pool = <%= @bareos_client['bareos']['clients']['default_pool'] %> - FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> - Priority = <%= @bareos_client['bareos']['clients']['jobdef_default_runlevel'] %> - Write Bootstrap = "/var/lib/bareos/%c.bsr" - SpoolData = <%= @bareos_client['bareos']['clients']['spool_data'] %> -} - -# Default Job -Job { - Name = "<%= @bareos_client['fqdn'] %>-Job" - JobDefs = "<%= @bareos_client['fqdn'] %>-JobDef" -} - -# Restore Job -Job { - Name = "<%= @bareos_client['fqdn'] %>-Restore" - Type = Restore - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Storage = <%= @bareos_client['bareos']['clients']['storage'] %> - Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Messages = <%= node['bareos']['messages']['default_messages'] %> - Where = /tmp/<%= @bareos_client['fqdn'] %>_restored/ -} - -FileSet { - Name = "<%= @bareos_client['fqdn'] %>-Fileset" - Include { - Options { - signature = MD5 - } - File = / - Exclude Dir Containing = .bareos_ignore - } - Exclude { - File = /var/lib/bareos - File = /var/lib/bareos/storage - File = /var/lib/pgsql - File = /var/lib/mysql - File = /proc - File = /tmp - File = /.journal - File = /.fsck - File = /spool - } -} - -<% if @bareos_client['bareos']['clients']['enable_vfulls'] %> -# VirtualFull Job -<% @client_vfulljob.each do |vjob_name, vjob| %> -Job { - Name = "<%= vjob_name %>" - Client = <%= @bareos_client['fqdn'] %>-fd - JobDefs = "<%= @bareos_client['fqdn'] %>-VFullJobDef" - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> -} - -JobDefs { - Name = "<%= @bareos_client['fqdn'] %>-VFullJobDef" - Type = Backup - Level = VirtualFull - Client = <%= @bareos_client['fqdn'] %>-fd - FileSet = "<%= @bareos_client['fqdn'] %>-Fileset" - Schedule = "<%= @bareos_client['bareos']['clients']['vfull_schedule'] %>" - Storage = <%= @bareos_client['bareos']['storage']['main_storage'] %> - Messages = <%= node['bareos']['messages']['default_messages'] %> - Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - IncrementalBackupPool = <%= @bareos_client['bareos']['clients']['incremental_pool'] %> - DifferentialBackupPool = <%= @bareos_client['bareos']['clients']['differential_pool'] %> - FullBackupPool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Priority = <%= node['bareos']['clients']['vfull_priority'] %> - Write Bootstrap = "<%= node['bareos']['clients']['bootstrap_file'] %>" - SpoolData = <%= @bareos_client['bareos']['clients']['vfull_spool'] %> - Maximum Concurrent Jobs = <%= node['bareos']['clients']['vfull_concurrent_jobs'] %> - Allow Duplicate Jobs = <%= node['bareos']['clients']['vfull_duplicate_jobs'] %> - Cancel Lower Level Duplicates = <%= node['bareos']['clients']['vfull_cancel_low_duplicates'] %> - Reschedule On Error = <%= node['bareos']['clients']['vfull_reschedule_on_fail'] %> - Reschedule Interval = <%= node['bareos']['clients']['vfull_reschedule_interval'] %> - Reschedule Times = <%= node['bareos']['clients']['vfull_reschedule_times'] %> - Accurate = <%= @bareos_client['bareos']['clients']['vfull_accurate'] %> -} - -Schedule { - Name = <%= @bareos_client['bareos']['clients']['vfull_schedule'] %> - Run = Level=VirtualFull on 1 at 3:00 -} - -Pool { - Name = <%= @bareos_client['bareos']['clients']['vfull_pool'] %> - Pool Type = Backup - Catalog Files = <%= @bareos_client['bareos']['clients']['catalog_files'] %> - AutoPrune = <%= @bareos_client['bareos']['clients']['autoprune'] %> - Storage = <%= @bareos_client['bareos']['clients']['vfull_storage'] %> - Next Pool = <%= @bareos_client['bareos']['clients']['full_pool'] %> - Volume Retention = <%= @bareos_client['bareos']['clients']['volume_retention'] %> -} -<% end %> From 953938d22ef70ea413090820bdefd1d5f1e66aac Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 29 Oct 2015 15:00:01 -0700 Subject: [PATCH 119/311] Pulling in the contrib repo bits from 1.0.0 branch --- recipes/repo.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/recipes/repo.rb b/recipes/repo.rb index 945c1d4..4d90c6c 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -19,18 +19,35 @@ # Add repos for supported platform families, else give fatal error during chef run case node['platform_family'] when 'rhel', 'fedora' + yum_repository node['bareos']['yum_repository'] do description node['bareos']['description'] baseurl node['bareos']['baseurl'] gpgkey node['bareos']['gpgkey'] action :create end + + yum_repository node['bareos']['contrib_yum_repository'] do + description node['bareos']['contrib_description'] + baseurl node['bareos']['contrib_baseurl'] + gpgkey node['bareos']['contrib_gpgkey'] + action :create + end + when 'debian' + apt_repository 'bareos' do uri node['bareos']['baseurl'] components ['/'] key node['bareos']['gpgkey'] end + + apt_repository 'bareos_contrib' do + uri node['bareos']['contrib_baseurl'] + components ['/'] + key node['bareos']['contrib_gpgkey'] + end + else Chef::Log.fatal('System is not in the currently supported OS list') end From 9e0142845bc1161e62b56bbe7f92eefa620a6fb7 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 29 Oct 2015 15:04:46 -0700 Subject: [PATCH 120/311] adding in necessary attributes to handle contrib repo --- attributes/default.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 0900d66..f312625 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -17,25 +17,37 @@ when 'debian' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version'].to_i}.0/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Debian_#{node['platform_version'].to_i}.0/Release.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/Debian_#{node['platform_version'].to_i}.0/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/Debian_#{node['platform_version'].to_i}.0/Release.key" when 'ubuntu' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/xUbuntu_#{node['platform_version']}/Release.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/xUbuntu_#{node['platform_version']}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/xUbuntu_#{node['platform_version']}/Release.key" end when 'rhel' case node['platform'] - when 'centos' + when 'scientific', 'centos' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/CentOS_#{node['platform_version'].to_i}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" when 'redhat' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" end when 'fedora' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/Fedora_20/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/Fedora_20/repodata/repomd.xml.key" else default['bareos']['baseurl'] = nil default['bareos']['gpgkey'] = nil + default['bareos']['contrib_baseurl'] = nil + default['bareos']['contrib_gpgkey'] = nil end # Messages From 6c71b0a5816c4f2616e4cb1b54e9e3203a153b99 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 13:59:08 -0700 Subject: [PATCH 121/311] fixing repos, adding conrib, adding example hashes for dir --- attributes/default.rb | 90 ++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index f312625..bc8e8e7 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,14 +1,17 @@ # Repository default['bareos']['url'] = 'http://download.bareos.org/bareos/release' +default['bareos']['contrib_url'] = 'http://download.bareos.org/bareos/contrib' # Used to have 'latest' as default, had potential update dangers # default['bareos']['version'] = 'latest' <--- Could be dangerous, ***CAUTION*** -default['bareos']['version'] = '14.2' # <--- Latest version as of 6-26-15 +default['bareos']['version'] = '14.2' # <--- Latest Stable version as of 6-26-15 if platform_family?('rhel', 'fedora') default['bareos']['yum_repository'] = 'bareos' default['bareos']['description'] = "Backup Archiving REcovery Open Sourced Current #{node['bareos']['version']}" + default['bareos']['contrib_yum_repository'] = 'bareos_contrib' + default['bareos']['contrib_description'] = "Backup Archiving REcovery Open Sourced Current #{node['bareos']['version']} contrib" end case node['platform_family'] @@ -27,7 +30,12 @@ end when 'rhel' case node['platform'] - when 'scientific', 'centos' + when 'centos' + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/CentOS_#{node['platform_version'].to_i}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" + when 'scientific' default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/" default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/CentOS_#{node['platform_version'].to_i}/repodata/repomd.xml.key" default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/CentOS_#{node['platform_version'].to_i}/" @@ -65,6 +73,7 @@ default['bareos']['database']['dbaddress'] = nil # Clients +default['bareos']['clients']['name'] = node['fqdn'] default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 @@ -85,6 +94,7 @@ default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] +default['bareos']['clients']['fileset_signature'] = 'MD5' default['bareos']['clients']['enable_vfulls'] = false default['bareos']['clients']['vfull_priority'] = 9 @@ -98,48 +108,40 @@ default['bareos']['clients']['vfull_reschedule_interval'] = '30 minutes' default['bareos']['clients']['vfull_reschedule_times'] = 1 -# Clients Definitions - You have the power, here is an example for a default definition -default['bareos']['clients']['pools']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' -} - # Jobs - You have the power, here is an example for a default definition -default['bareos']['clients']['job_definitions']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' +default['bareos']['clients']['jobs']['_default_job'] = { + 'key' => 'value' } # Job Definitions - You have the power, here is an example for a default definition -default['bareos']['clients']['pools']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' +default['bareos']['clients']['job_definitions']['_default_job_def'] = { + 'key' => 'value' } # Filesets - You have the power, here is an example for a default definition -default['bareos']['clients']['pools']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' +default['baroes']['clients']['filesets']['_default_file_set'] = { + 'options' => { + 'signature' => 'MD5' + }, + 'include' => { + 'File' => '/', + 'Exclude Dir Containing' => '.bareos_ignore' + }, + 'exclude' => { + 'File' => '/var/lib/bareos', + 'File' => '/var/lib/bareos/storage', + 'File' => '/var/lib/pgsql', + 'File' => '/var/lib/mysql', + 'File' => '/proc', + 'File' => 'tmp', + 'File' => '/.journal', + 'File' => '/.fsck', + 'File' => '/spool' + } } # Pools - You have the power, here is an example for default pool only -default['bareos']['clients']['pools']['default'] = { +default['bareos']['clients']['pools']['_default_pool'] = { 'Pool Type' => 'Backup', 'Recycle' => 'yes', 'Volume Retention' => '30 days', @@ -149,26 +151,17 @@ } # Schedules - You have the power, here is an example for a default definition -default['bareos']['clients']['pools']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' +default['bareos']['clients']['schedules']['monthly'] = { + 'key' => 'value' } # Storages - You have the power, here is an example for a default definition -default['bareos']['clients']['pools']['default'] = { - 'Pool Type' => 'Backup', - 'Recycle' => 'yes', - 'Volume Retention' => '30 days', - 'Maximum Volume Bytes' => '10G', - 'Maximum Volumes' => '25', - 'LabelFormat' => 'FileVolume-' +default['bareos']['clients']['storages']['_local_file_storage'] = { + 'key' => 'value' } # Storage Daemon +default['bareos']['storage']['name'] = node['fqdn'] default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks @@ -178,6 +171,7 @@ default['bareos']['storage']['max_concurrent_jobs'] = 20 # Director +default['bareos']['director']['name'] = node['fqdn'] default['bareos']['director']['dir_search_query'] = 'role:bareos_server' default['bareos']['director']['dir_port'] = 9101 default['bareos']['director']['dir_max_concurrent_jobs'] = 20 From e67f375634f9f62ac2ee6a6035e2f735a6a0eb79 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 14:00:18 -0700 Subject: [PATCH 122/311] cleaning up some left overs that won't be needed, adding a reload dir/restart split resources depending --- recipes/server.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 97c3f98..2ee1bbe 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -51,7 +51,7 @@ db_password: node['bareos']['database']['dbpassword'], db_address: node['bareos']['database']['dbaddress'] ) - notifies :run, 'execute[reload-dir]', :delayed + notifies :run, 'execute[restart-dir]', :delayed end # Create clients config based on sets of hashes, see attributes file for example @@ -67,8 +67,7 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, - clients: bareos_clients + bareos_client: bareos_clients ) notifies :run, 'execute[reload-dir]', :delayed end @@ -93,7 +92,6 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, job_definitions: node['bareos']['clients']['job_definitions'] ) notifies :run, 'execute[reload-dir]', :delayed @@ -106,10 +104,7 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, - fileset_options: node['baroes']['clients']['filesets']['options'], - fileset_include_files: node['bareos']['clients']['filesets']['include'], - fileset_exclude_files: node['bareos']['clients']['filesets']['exclude'] + fileset_config: node['baroes']['clients']['filesets'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -121,7 +116,6 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, client_pools: node['bareos']['clients']['pools'] ) notifies :run, 'execute[reload-dir]', :delayed @@ -134,7 +128,6 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, client_schedules: node['bareos']['clients']['schedules'] ) notifies :run, 'execute[reload-dir]', :delayed @@ -152,8 +145,15 @@ notifies :run, 'execute[reload-dir]', :delayed end -# Allow a restart of the director daemon if called with tests up front +# Allow a reload of the director daemon configs if called with tests up front execute 'reload-dir' do + command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf" && echo reload | bconsole' + action :nothing + notifies :restart, 'service[bareos-dir]', :delayed +end + +# Allow a restart of the director daemon if called with tests up front +execute 'restart-dir' do command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' action :nothing notifies :restart, 'service[bareos-dir]', :delayed From 999f675a989f410daaed2e427ca716e012607321 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 14:00:42 -0700 Subject: [PATCH 123/311] needs testing but should add based on hashing now I think --- templates/default/filesets.conf.erb | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index 8aab076..413b80b 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -1,19 +1,26 @@ <%# BAREOS FILESET DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +# Generated by Chef for <%= node['bareos']['clients']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Pool Definition File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - -<% @bareos_clients.each do |fileset_name, fileset| %> -Pool { - Name = <%= pool_name %> -<% pool.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> +<% @fileset_config.each do |fileset_name, section| -%> +FileSet { + Name = "<%= fileset_name %>-Fileset" + Include { + Options { + <% fileset_name[:options].each do |key1, value1| %> + <%= key1 %> = <%= value1 %> + <% end %> + } + <% fileset_name[:include].each do |key2, value2| %> + <%= key2 %> = <%= value2 %> + <% end %> + } + Exclude { + <% fileset_name[:exclude].each do |key3, value3| %> + <%= key3 %> = <%= value3 %> + <% end %> + } } <% end %> From 547d7befdcdbb4f3eeb1429c5fccbabf830b10ca Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 14:20:01 -0700 Subject: [PATCH 124/311] Key fail, fixed --- attributes/default.rb | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index bc8e8e7..551e94d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -124,19 +124,25 @@ 'signature' => 'MD5' }, 'include' => { - 'File' => '/', - 'Exclude Dir Containing' => '.bareos_ignore' + 'File' => [ + '/' + ], + 'Exclude Dir Containing' => [ + '.bareos_ignore' + ] }, 'exclude' => { - 'File' => '/var/lib/bareos', - 'File' => '/var/lib/bareos/storage', - 'File' => '/var/lib/pgsql', - 'File' => '/var/lib/mysql', - 'File' => '/proc', - 'File' => 'tmp', - 'File' => '/.journal', - 'File' => '/.fsck', - 'File' => '/spool' + 'File' => [ + '/var/lib/bareos', + '/var/lib/bareos/storage', + '/var/lib/pgsql', + '/var/lib/mysql', + '/proc', + 'tmp', + '/.journal', + '/.fsck', + '/spool' + ] } } From 63a59bf5dd7b697b4cc43aaa27e02b4d3b25985b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 14:22:39 -0700 Subject: [PATCH 125/311] still not there I think but idea is there mostly --- templates/default/filesets.conf.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index 413b80b..de345e6 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -9,16 +9,16 @@ FileSet { Name = "<%= fileset_name %>-Fileset" Include { Options { - <% fileset_name[:options].each do |key1, value1| %> + <% fileset_name['options'].each do |key1, value1| %> <%= key1 %> = <%= value1 %> <% end %> } - <% fileset_name[:include].each do |key2, value2| %> + <% fileset_name['include'].each do |key2, value2| %> <%= key2 %> = <%= value2 %> <% end %> } Exclude { - <% fileset_name[:exclude].each do |key3, value3| %> + <% fileset_name['exclude'].each do |key3, value3| %> <%= key3 %> = <%= value3 %> <% end %> } From 6c41000ec491fa82f71a365a3293dcb5f06a743a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 15:24:07 -0700 Subject: [PATCH 126/311] able to cut down on number of static attributes now --- attributes/default.rb | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 551e94d..edc9976 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -75,38 +75,22 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' -default['bareos']['clients']['fd_port'] = 9102 -default['bareos']['clients']['max_concurrent_jobs'] = 20 default['bareos']['clients']['client_list'] = %w(node) -default['bareos']['clients']['file_retention'] = '30 days' -default['bareos']['clients']['job_retention'] = '6 months' -default['bareos']['clients']['volume_retention'] = '6 months' -default['bareos']['clients']['catalog_files'] = 'yes' -default['bareos']['clients']['autoprune'] = 'yes' -default['bareos']['clients']['heartbeat_interval'] = 600 default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' -default['bareos']['clients']['spool_data'] = 'no' -default['bareos']['clients']['jobdef_default_runlevel'] = 10 -default['bareos']['clients']['jobdef_default_schedule'] = 'WeeklyCycle' default['bareos']['clients']['jobdef_default_messages'] = node['bareos']['messages']['default_messages'] default['bareos']['clients']['jobdef_default_storage'] = 'File' default['bareos']['clients']['jobdef_default_fileset'] = "#{node['fqdn']}-Fileset" default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] -default['bareos']['clients']['vfull_storage'] = node['bareos']['clients']['jobdef_default_storage'] -default['bareos']['clients']['fileset'] = node['bareos']['clients']['jobdef_default_fileset'] -default['bareos']['clients']['fileset_signature'] = 'MD5' - -default['bareos']['clients']['enable_vfulls'] = false -default['bareos']['clients']['vfull_priority'] = 9 -default['bareos']['clients']['vfull_accurate'] = 'no' # More sane option is no, yes is preferred if possible -default['bareos']['clients']['vfull_spool'] = 'no' # Not useful in most cases but available -default['bareos']['clients']['vfull_schedule'] = "#{node['fqdn']}-VFullSchedule" -default['bareos']['clients']['vfull_concurrent_jobs'] = 6 -default['bareos']['clients']['vfull_duplicate_jobs'] = 'no' -default['bareos']['clients']['vfull_cancel_low_duplicates'] = 'yes' -default['bareos']['clients']['vfull_reschedule_on_fail'] = 'yes' -default['bareos']['clients']['vfull_reschedule_interval'] = '30 minutes' -default['bareos']['clients']['vfull_reschedule_times'] = 1 + +# General Client Config, can override with role or wrapper, may need overrides per host +default['bareos']['clients']['conf']["#{node['bareos']['clients']['name']}"] = { + 'Address' => node['bareos']['clients']['name'], + 'FDPort' => '9102', + 'File Retention' => '30 days', + 'Job Retention' => '6 months', + 'AutoPrune' => 'yes', + 'Maximum Concurrent Jobs' => '20' +} # Jobs - You have the power, here is an example for a default definition default['bareos']['clients']['jobs']['_default_job'] = { From fe28e4dd561c693f5c140ca2d21508232c263311 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 15:25:07 -0700 Subject: [PATCH 127/311] reverting slightly, adding in client conf hashes --- recipes/server.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/server.rb b/recipes/server.rb index 2ee1bbe..1015407 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -67,7 +67,8 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients + bareos_clients: bareos_clients, + client_config: bareos_clients['bareos']['clients']['conf'] ) notifies :run, 'execute[reload-dir]', :delayed end From 0fa74c918791cb6ff47a2d1ff89f281e7187a9c6 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 15:26:09 -0700 Subject: [PATCH 128/311] reworking this a bit to do simpler hashing like pools --- templates/default/clients.conf.erb | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 3171fea..a94b938 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -1,24 +1,16 @@ <%# BAREOS CLIENT TEMPLATE %> -# Generated by Chef for <%= @bareos_client['fqdn'] %>-fd +# Generated by Chef for <%= @bareos_clients['bareos']['clients']['name'] %>-fd # Local modifications will be overwritten. # # Bareos Client Configuration File -# Borrowed some logic from the Nagios Cookbook -<% @clients.each do |client| %> +<% @bareos_clients.each do |client_def| %> Client { - Name = <%= client['bareos']['clients']['name'] %> - <% @client.each do |key,items| %> - <% case items %> - <% when String %> -<%= key + '=' + items %> - <% when Fixnum %> -<%= key + '=' + items.to_s %> - <% when Array %> - <% items.each do |item| %> -<%= key + '=' + item %> - <% end %> - <% end %> + Name = <%= client_def['bareos']['clients']['name'] %>-fd + Password = "<%= client['bareos']['fd_password'] %>" # password for FileDaemon + Catalog = <%= client['bareos']['database']['catalog_name'] %> + <% @client_config.each do |key, value| %> + <%= key %> = <%= value %> <% end %> } <% end %> From 68bc25dc1f120b4b48792637c1ea9c9e74b3b895 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 15:28:16 -0700 Subject: [PATCH 129/311] foodcritic cleanup --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index edc9976..545d1a5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -83,7 +83,7 @@ default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] # General Client Config, can override with role or wrapper, may need overrides per host -default['bareos']['clients']['conf']["#{node['bareos']['clients']['name']}"] = { +default['bareos']['clients']['conf'][node.default['bareos']['clients']['name']] = { 'Address' => node['bareos']['clients']['name'], 'FDPort' => '9102', 'File Retention' => '30 days', From 72b51d32ce039e27df54f2322c9872bf75cf6a21 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 16:49:05 -0700 Subject: [PATCH 130/311] getting in some basics so the templates match their true purpose --- templates/default/job_definitions.conf.erb | 20 +++++++---------- templates/default/jobs.conf.erb | 25 ++++++++++------------ templates/default/pools.conf.erb | 7 +----- templates/default/schedules.conf.erb | 17 ++++++--------- templates/default/storages.conf.erb | 17 ++++++--------- 5 files changed, 32 insertions(+), 54 deletions(-) diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb index 6ce1118..420dfeb 100644 --- a/templates/default/job_definitions.conf.erb +++ b/templates/default/job_definitions.conf.erb @@ -1,18 +1,14 @@ -<%# BAREOS POOLS DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +<%# BAREOS JOB DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= @dir_name %>-dir # Local modifications will be overwritten. # -# Bareos Pool Definition File +# Bareos Job Definitions File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - -<% @client_pools.each do |pool_name, pool| %> -Pool { - Name = <%= pool_name %> -<% pool.each do |key,value| %> +<% @job_defs.each do |def_name, def_value| %> +JobDefs { + Name = <%= def_name %> + Type = Backup +<% def_value.each do |key,value| %> <%= key %> = <%= value %> <% end %> } diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 6ce1118..0fda555 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -1,19 +1,16 @@ -<%# BAREOS POOLS DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +<%# BAREOS JOBS TEMPLATE %> +# Generated by Chef for <%= @dir_name %>-dir # Local modifications will be overwritten. # -# Bareos Pool Definition File +# Bareos Jobs File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - -<% @client_pools.each do |pool_name, pool| %> -Pool { - Name = <%= pool_name %> -<% pool.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> +<% @bareos_client.each do |client, job| %> +Job { + Name = "<%= client['bareos']['clients']['name'] %>-Job" + Client = <%= client['bareos']['clients']['name'] %>-fd + <% job.each do |key,value| %> + <%= key %> = <%= value %> + <% end %> } + <% end %> diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb index 6ce1118..dfa72d9 100644 --- a/templates/default/pools.conf.erb +++ b/templates/default/pools.conf.erb @@ -1,14 +1,9 @@ <%# BAREOS POOLS DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Pool Definition File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - <% @client_pools.each do |pool_name, pool| %> Pool { Name = <%= pool_name %> diff --git a/templates/default/schedules.conf.erb b/templates/default/schedules.conf.erb index 6ce1118..ca4fc95 100644 --- a/templates/default/schedules.conf.erb +++ b/templates/default/schedules.conf.erb @@ -1,18 +1,13 @@ -<%# BAREOS POOLS DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +<%# BAREOS SCHEDULE DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= @dir_name %>-dir # Local modifications will be overwritten. # -# Bareos Pool Definition File +# Bareos Schedule Definitions File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - -<% @client_pools.each do |pool_name, pool| %> +<% @scheds.each do |sched_name, sched| %> Pool { - Name = <%= pool_name %> -<% pool.each do |key,value| %> + Name = <%= sched_name %> +<% sched.each do |key,value| %> <%= key %> = <%= value %> <% end %> } diff --git a/templates/default/storages.conf.erb b/templates/default/storages.conf.erb index 6ce1118..5c96b6a 100644 --- a/templates/default/storages.conf.erb +++ b/templates/default/storages.conf.erb @@ -1,18 +1,13 @@ -<%# BAREOS POOLS DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %>-dir +<%# BAREOS STORAGE DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= @dir_name %>-dir # Local modifications will be overwritten. # -# Bareos Pool Definition File +# Bareos Storage Definitions File -<%-%> -<%# Here is an example attribute that will populate pools %> -<%# @bareos_client['bareos']['clients']['pools']["Full-Pool"] ={'Pool Type' => 'Backup'} %> -<%-%> - -<% @client_pools.each do |pool_name, pool| %> +<% @storage_defs.each do |stor_name, stor| %> Pool { - Name = <%= pool_name %> -<% pool.each do |key,value| %> + Name = <%= stor_name %> +<% stor.each do |key,value| %> <%= key %> = <%= value %> <% end %> } From 8e0b5098657fc6569a5fab0b7577a94c97840466 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 16:52:29 -0700 Subject: [PATCH 131/311] prepping some more naming structures --- templates/default/bareos-dir.conf.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index f00f7ab..5b7a027 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -1,5 +1,5 @@ <%# DIRECTOR TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= @dir_name %>-dir # Local modifications will be overwritten. # # Bareos Director Configuration File @@ -8,7 +8,7 @@ # Director Definition # ####################### Director { - Name = <%= node['fqdn'] %>-dir + Name = <%= @dir_name %>-dir DIRport = <%= node['bareos']['director']['dir_port'] %> QueryFile = "/usr/lib/bareos/scripts/query.sql" Maximum Concurrent Jobs = <%= node['bareos']['director']['dir_max_concurrent_jobs'] %> @@ -24,8 +24,8 @@ Director { # Catalog Backup Job # ###################### Job { - Name = "<%= node['fqdn'] %>-BackupCatalog" - JobDefs = "<%= node['fqdn'] %>-JobDef" + Name = "<%= @dir_name %>-BackupCatalog" + JobDefs = "<%= @dir_name %>-JobDef" Level = Full FileSet = "Catalog" Schedule = "WeeklyCycleAfterBackup" @@ -91,7 +91,7 @@ Schedule { ################### Storage { Name = File - Address = <%= node['fqdn'] %> # N.B. Use a fully qualified name here + Address = <%= @dir_name %> # N.B. Use a fully qualified name here Password = "<%= node['bareos']['sd_password'] %>" Device = FileStorage Media Type = File @@ -115,7 +115,7 @@ Catalog { # Console/Messages # #################### Console { - Name = <%= node['fqdn'] %>-mon + Name = <%= @dir_name %>-mon Password = "<%= node['bareos']['mon_password'] %>" CommandACL = <%= node['bareos']['director']['console_commandacl'] %> } From 498328cad0c6e1c2941cb156922f35945d105dbf Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 16:54:35 -0700 Subject: [PATCH 132/311] syncing variables with what is used in templates --- recipes/server.rb | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/recipes/server.rb b/recipes/server.rb index 1015407..d50eac5 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -49,7 +49,8 @@ db_name: node['bareos']['database']['dbname'], db_user: node['bareos']['database']['dbuser'], db_password: node['bareos']['database']['dbpassword'], - db_address: node['bareos']['database']['dbaddress'] + db_address: node['bareos']['database']['dbaddress'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[restart-dir]', :delayed end @@ -68,7 +69,8 @@ mode '0640' variables( bareos_clients: bareos_clients, - client_config: bareos_clients['bareos']['clients']['conf'] + client_config: bareos_clients['bareos']['clients']['conf'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -80,8 +82,9 @@ group 'bareos' mode '0640' variables( - bareos_client: bareos_clients, - client_jobs: node['bareos']['clients']['jobs'] + bareos_clients: bareos_clients, + client_jobs: node['bareos']['clients']['jobs'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -93,7 +96,8 @@ group 'bareos' mode '0640' variables( - job_definitions: node['bareos']['clients']['job_definitions'] + job_definitions: node['bareos']['clients']['job_definitions'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -105,7 +109,8 @@ group 'bareos' mode '0640' variables( - fileset_config: node['baroes']['clients']['filesets'] + fileset_config: node['baroes']['clients']['filesets'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -117,7 +122,8 @@ group 'bareos' mode '0640' variables( - client_pools: node['bareos']['clients']['pools'] + client_pools: node['bareos']['clients']['pools'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -129,7 +135,8 @@ group 'bareos' mode '0640' variables( - client_schedules: node['bareos']['clients']['schedules'] + client_schedules: node['bareos']['clients']['schedules'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end @@ -141,7 +148,8 @@ group 'bareos' mode '0640' variables( - director_storages: node['bareos']['director']['storages'] + director_storages: node['bareos']['director']['storages'], + dir_name: node['bareos']['director']['name'] ) notifies :run, 'execute[reload-dir]', :delayed end From 7bc123f2abce891b83a4c65965fa8d07653e0873 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 30 Oct 2015 16:55:20 -0700 Subject: [PATCH 133/311] adding future work for myself, and doing some variable work again --- templates/default/bareos-fd.conf.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index f80b9f8..6013d5c 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -1,11 +1,11 @@ <%# FILE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= @fd_name %>-fd # Local modifications will be overwritten. # # Bareos Client FileDaemon Configuration File FileDaemon { - Name = <%= node['fqdn'] %>-fd + Name = <%= @fd_name %>-fd FDPort = <%= node['bareos']['clients']['fd_port'] %> Maximum Concurrent Jobs = <%= node['bareos']['clients']['max_concurrent_jobs'] %> Heartbeat Interval = <%= node['bareos']['clients']['heartbeat_interval'] %> From 0679a93af63d827402e1a8468ab972133b02b240 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 7 Nov 2015 11:06:42 -0800 Subject: [PATCH 134/311] bumping to 2.0.1 so tagging doesn't conflict with branch naming convention --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 695549a..56d9214 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.0' +version '2.0.1' %w( centos redhat ).each do |os| supports os, '>= 6.0' From d707ff3ab561a4698e8af8f6588c0c31ba79395d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sun, 8 Nov 2015 01:57:42 -0800 Subject: [PATCH 135/311] pushing a working model on cookbook, this uses hashing methods for dynamic configs, more work needed but working now --- .kitchen.yml | 23 +--- attributes/default.rb | 121 ++++++++++++-------- recipes/client.rb | 4 +- recipes/server.rb | 51 ++++----- recipes/storage.rb | 8 +- recipes/workstation.rb | 18 ++- templates/default/bareos-dir.conf.erb | 56 +-------- templates/default/bareos-fd.conf.erb | 4 +- templates/default/bareos-sd.conf.erb | 20 ++-- templates/default/bconsole.conf.erb | 6 +- templates/default/clients.conf.erb | 9 +- templates/default/filesets.conf.erb | 10 +- templates/default/job_definitions.conf.erb | 13 +-- templates/default/jobs.conf.erb | 16 ++- templates/default/pools.conf.erb | 2 +- templates/default/schedules.conf.erb | 20 ++-- templates/default/storages.conf.erb | 15 +-- test/integration/roles/bareos_director.json | 4 +- 18 files changed, 190 insertions(+), 210 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 15d29e1..d9a6f4b 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -10,42 +10,21 @@ platforms: - name: debian-7.8 run_list: - recipe[apt] - - name: ubuntu-12.04 run_list: - recipe[apt] - - name: ubuntu-14.04 run_list: - recipe[apt] - - name: centos-6.7 - - name: centos-7.1 - - #- name: fedora-19 - # attributes: - # postgresql: - # config: - # work_mem: "32MB" - - name: fedora-20 - - name: fedora-21 -roles_path: test/integration/roles/ +roles_path: test/integration/roles/ suites: - name: aio-server run_list: - role[bareos_director] attributes: - - - name: aio-server-pools - run_list: - - role[bareos_director] - attributes: - bareos: - clients: - host_pools: true - enable_vfulls: true diff --git a/attributes/default.rb b/attributes/default.rb index 545d1a5..b5dad9a 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,6 +74,11 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] + +default['bareos']['clients']['fd_port'] = 9102 +default['bareos']['clients']['max_concurrent_jobs'] = 20 +default['bareos']['clients']['heartbeat_interval'] = 600 + default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' default['bareos']['clients']['client_list'] = %w(node) default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' @@ -82,9 +87,38 @@ default['bareos']['clients']['jobdef_default_fileset'] = "#{node['fqdn']}-Fileset" default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] -# General Client Config, can override with role or wrapper, may need overrides per host -default['bareos']['clients']['conf'][node.default['bareos']['clients']['name']] = { - 'Address' => node['bareos']['clients']['name'], +# Storage Daemon +default['bareos']['storage']['name'] = node['fqdn'] +default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' +default['bareos']['storage']['sd_port'] = 9103 +default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks +default['bareos']['storage']['main_storage'] = 'File' +default['bareos']['storage']['servers'] = %w(node) +default['bareos']['storage']['sd_mon_enable'] = 'yes' +default['bareos']['storage']['max_concurrent_jobs'] = 20 + +# Director +default['bareos']['director']['name'] = node['fqdn'] +default['bareos']['director']['dir_search_query'] = 'roles:bareos_director' +default['bareos']['director']['dir_port'] = 9101 +default['bareos']['director']['dir_max_concurrent_jobs'] = 20 +default['bareos']['director']['servers'] = %w(node) +default['bareos']['director']['console_commandacl'] = 'status, .status' +default['bareos']['director']['heartbeat_interval'] = 600 + +# Subscription Management (Director) +default['bareos']['director']['dir_subscription'] = nil +default['bareos']['director']['dir_subs'] = nil + +# Workstation +default['bareos']['workstation']['name'] = node['fqdn'] + +########################## +# Example Default Hashes # +########################## + +# General Client Config +default['bareos']['clients']['conf'] = { 'FDPort' => '9102', 'File Retention' => '30 days', 'Job Retention' => '6 months', @@ -92,28 +126,32 @@ 'Maximum Concurrent Jobs' => '20' } -# Jobs - You have the power, here is an example for a default definition -default['bareos']['clients']['jobs']['_default_job'] = { - 'key' => 'value' +# Jobs +default['bareos']['clients']['jobs'] = { + 'JobDefs' => 'default-def' } -# Job Definitions - You have the power, here is an example for a default definition -default['bareos']['clients']['job_definitions']['_default_job_def'] = { - 'key' => 'value' +# Job Definitions +default['bareos']['clients']['job_definitions']['default-def'] = { + 'Level' => 'Incremental', + 'Fileset' => 'default-fileset', + 'Schedule' => 'monthly', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Priority' => '10', + 'Write Bootstrap' => '"/var/lib/bareos/%c.bsr"', + 'SpoolData' => 'no' } -# Filesets - You have the power, here is an example for a default definition -default['baroes']['clients']['filesets']['_default_file_set'] = { +# Filesets +default['baroes']['clients']['filesets']['default'] = { 'options' => { 'signature' => 'MD5' }, 'include' => { - 'File' => [ - '/' - ], - 'Exclude Dir Containing' => [ - '.bareos_ignore' - ] + 'File' => '/', + 'Exclude Dir Containing' => '.bareos_ignore' }, 'exclude' => { 'File' => [ @@ -130,8 +168,8 @@ } } -# Pools - You have the power, here is an example for default pool only -default['bareos']['clients']['pools']['_default_pool'] = { +# Pools +default['bareos']['clients']['pools']['default-file-pool'] = { 'Pool Type' => 'Backup', 'Recycle' => 'yes', 'Volume Retention' => '30 days', @@ -140,35 +178,24 @@ 'LabelFormat' => 'FileVolume-' } -# Schedules - You have the power, here is an example for a default definition +# Schedules default['bareos']['clients']['schedules']['monthly'] = { - 'key' => 'value' + 'Description' => [ + 'Default Monthly Schedule' + ], + 'Run' => [ + 'Full 1st sun at 23:05', + 'Differential 2nd-5th sun at 23:05', + 'Incremental mon-sat at 23:05' + ], + 'Enabled' => [ + 'yes' + ], } -# Storages - You have the power, here is an example for a default definition -default['bareos']['clients']['storages']['_local_file_storage'] = { - 'key' => 'value' +# Storages +default['bareos']['clients']['storages']['default-file-storage'] = { + 'Address' => node['bareos']['storage']['name'], # N.B. Use a fully qualified name here + 'Device' => 'FileStorage', + 'Media Type' => 'File' } - -# Storage Daemon -default['bareos']['storage']['name'] = node['fqdn'] -default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' -default['bareos']['storage']['sd_port'] = 9103 -default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks -default['bareos']['storage']['main_storage'] = 'File' -default['bareos']['storage']['servers'] = %w(node) -default['bareos']['storage']['sd_mon_enable'] = 'yes' -default['bareos']['storage']['max_concurrent_jobs'] = 20 - -# Director -default['bareos']['director']['name'] = node['fqdn'] -default['bareos']['director']['dir_search_query'] = 'role:bareos_server' -default['bareos']['director']['dir_port'] = 9101 -default['bareos']['director']['dir_max_concurrent_jobs'] = 20 -default['bareos']['director']['servers'] = %w(node) -default['bareos']['director']['console_commandacl'] = 'status, .status' -default['bareos']['director']['heartbeat_interval'] = 600 - -# Subscription Management (Director) -default['bareos']['director']['dir_subscription'] = nil -default['bareos']['director']['dir_subs'] = nil diff --git a/recipes/client.rb b/recipes/client.rb index a9e7762..0415e47 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -23,6 +23,8 @@ node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] +dir_search_query = node.default['bareos']['director']['dir_search_query'] + # Installation of the BAREOS File Daemon package 'bareos-filedaemon' @@ -30,7 +32,7 @@ if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, node['bareos']['dir_search_query']) + bareos_dir = search(:node, dir_search_query) end # Setup the configs for any local/remote File Daemons clients diff --git a/recipes/server.rb b/recipes/server.rb index d50eac5..1bbf245 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -31,11 +31,13 @@ end end -# Create a blank placeholder for d directory -execute 'director_conf_holder' do - command 'touch /etc/bareos/bareos-dir.d/.conf' - creates '/etc/bareos/bareos-dir.d/.conf' - action :run +# Create a placeholder file so BAREOS doesn't throw error when none found +file '/etc/bareos/bareos-dir.d/.conf' do + content '# This is a base file so the recipe works with no additional help' + owner 'root' + group 'root' + mode '0755' + action :create end # Create the base config for the Bareos Director @@ -56,12 +58,16 @@ end # Create clients config based on sets of hashes, see attributes file for example + +client_search_query = node['bareos']['clients']['client_search_query'] + if Chef::Config[:solo] bareos_clients = node['bareos']['clients']['client_list'] else - bareos_clients = search(:node, node['bareos']['clients']['client_search_query']) + bareos_clients = search(:node, client_search_query) end +# Create clients config based on sets of hashes template '/etc/bareos/bareos-dir.d/clients.conf' do source 'clients.conf.erb' owner 'bareos' @@ -69,13 +75,12 @@ mode '0640' variables( bareos_clients: bareos_clients, - client_config: bareos_clients['bareos']['clients']['conf'], - dir_name: node['bareos']['director']['name'] + client_conf: node['bareos']['clients']['conf'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create jobs config based on sets of hashes, see attributes file for example +# Create jobs config based on sets of hashes template '/etc/bareos/bareos-dir.d/jobs.conf' do source 'jobs.conf.erb' owner 'bareos' @@ -83,73 +88,67 @@ mode '0640' variables( bareos_clients: bareos_clients, - client_jobs: node['bareos']['clients']['jobs'], - dir_name: node['bareos']['director']['name'] + client_jobs: node['bareos']['clients']['jobs'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create job definitions config based on sets of hashes, see attributes file for example +# Create job definitions config based on sets of hashes template '/etc/bareos/bareos-dir.d/job_definitions.conf' do source 'job_definitions.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - job_definitions: node['bareos']['clients']['job_definitions'], - dir_name: node['bareos']['director']['name'] + job_definitions: node['bareos']['clients']['job_definitions'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create filesets config based on sets of hashes, see attributes file for example +# Create filesets config based on sets of hashes template '/etc/bareos/bareos-dir.d/filesets.conf' do source 'filesets.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - fileset_config: node['baroes']['clients']['filesets'], - dir_name: node['bareos']['director']['name'] + fileset_config: node['baroes']['clients']['filesets'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create pools config based on sets of hashes, see attributes file for example +# Create pools config based on sets of hashes template '/etc/bareos/bareos-dir.d/pools.conf' do source 'pools.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - client_pools: node['bareos']['clients']['pools'], - dir_name: node['bareos']['director']['name'] + client_pools: node['bareos']['clients']['pools'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create schedules config based on sets of hashes, see attributes file for example +# Create schedules config based on sets of hashes template '/etc/bareos/bareos-dir.d/schedules.conf' do source 'schedules.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - client_schedules: node['bareos']['clients']['schedules'], - dir_name: node['bareos']['director']['name'] + client_schedules: node['bareos']['clients']['schedules'] ) notifies :run, 'execute[reload-dir]', :delayed end -# Create storages config based on sets of hashes, see attributes file for example +# Create storages config based on sets of hashes template '/etc/bareos/bareos-dir.d/storages.conf' do source 'storages.conf.erb' owner 'bareos' group 'bareos' mode '0640' variables( - director_storages: node['bareos']['director']['storages'], - dir_name: node['bareos']['director']['name'] + client_storages: node['bareos']['clients']['storages'] ) notifies :run, 'execute[reload-dir]', :delayed end diff --git a/recipes/storage.rb b/recipes/storage.rb index 4e5f561..12af4ed 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -39,12 +39,16 @@ # end # Define both the bareos-sd and bareos-dir lists based on run_list searches + +storage_search_query = node['bareos']['storage']['storage_search_query'] +dir_search_query = node['bareos']['director']['dir_search_query'] + if Chef::Config[:solo] bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] else - bareos_sd = search(:node, node['bareos']['storage']['storage_search_query']) - bareos_dir = search(:node, node['bareos']['director']['dir_search_query']) + bareos_sd = search(:node, storage_search_query) + bareos_dir = search(:node, dir_search_query) end # Setup the bareos-sd config diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 564bfa7..994efcb 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -25,10 +25,13 @@ end # Define the list of bareos directors + +dir_search_query = node['bareos']['director']['dir_search_query'] + if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else - bareos_dir = search(:node, node['bareos']['director']['dir_search_query']) + bareos_dir = search(:node, dir_search_query) end # Setup the bconsole config, pushes out list of bareos-dirs and if solo mode @@ -37,14 +40,7 @@ mode 0640 owner 'bareos' group 'bareos' - if Chef::Config[:solo] - variables( - bareos_dir: bareos_dir, - solo_mode: Chef::Config[:solo] - ) - else - variables( - bareos_dir: bareos_dir - ) - end + variables( + bareos_dir: bareos_dir + ) end diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 5b7a027..da30738 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -20,12 +20,14 @@ Director { <% end %> } -###################### -# Catalog Backup Job # -###################### +############################## +# Default Catalog Backup Job # +############################## Job { Name = "<%= @dir_name %>-BackupCatalog" - JobDefs = "<%= @dir_name %>-JobDef" + Type = Backup + Client = <%= @dir_name %>-fd + JobDefs = "default-def" Level = Full FileSet = "Catalog" Schedule = "WeeklyCycleAfterBackup" @@ -35,31 +37,6 @@ Job { Priority = 11 # run after main backup } -#################### -# Default Filesets # -#################### -FileSet { - Name = "Full Set" - Include { - Options { - signature = MD5 - } - File = / - Exclude Dir Containing = .bareos_ignore - } - Exclude { - File = /var/lib/bareos - File = /var/lib/bareos/storage - File = /var/lib/pgsql - File = /var/lib/mysql - File = /proc - File = /tmp - File = /.journal - File = /.fsck - File = /spool - } -} - FileSet { Name = "Catalog" Include { @@ -71,32 +48,11 @@ FileSet { } } -##################### -# Default Schedules # -##################### -Schedule { - Name = "WeeklyCycle" - Run = Full 1st sun at 23:05 - Run = Differential 2nd-5th sun at 23:05 - Run = Incremental mon-sat at 23:05 -} - Schedule { Name = "WeeklyCycleAfterBackup" Run = Full sun-sat at 23:10 } -################### -# Default Storage # -################### -Storage { - Name = File - Address = <%= @dir_name %> # N.B. Use a fully qualified name here - Password = "<%= node['bareos']['sd_password'] %>" - Device = FileStorage - Media Type = File -} - ################### # Default Catalog # ################### diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index 6013d5c..f646f65 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -1,11 +1,11 @@ <%# FILE DAEMON TEMPLATE %> -# Generated by Chef for <%= @fd_name %>-fd +# Generated by Chef for <%= node['bareos']['clients']['name'] %>-fd # Local modifications will be overwritten. # # Bareos Client FileDaemon Configuration File FileDaemon { - Name = <%= @fd_name %>-fd + Name = "<%= node['bareos']['clients']['name'] %>-fd" FDPort = <%= node['bareos']['clients']['fd_port'] %> Maximum Concurrent Jobs = <%= node['bareos']['clients']['max_concurrent_jobs'] %> Heartbeat Interval = <%= node['bareos']['clients']['heartbeat_interval'] %> diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index e3a5520..fb626df 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -1,33 +1,33 @@ <%# STORAGE DAEMON TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= node['bareos']['storage']['name'] %> # Local modifications will be overwritten. # # Bareos Storage Daemon Configuration File# Storage { - Name = <%= node['fqdn'] %>-sd - SDPort = <%= node['bareos']['storage']['sd_port'] %> - Maximum Concurrent Jobs = <%= node['bareos']['storage']['max_concurrent_jobs'] %> + Name = "<%= node['bareos']['storage']['name'] %>-sd" + SDPort = "<%= node['bareos']['storage']['sd_port'] %>" + Maximum Concurrent Jobs = "<%= node['bareos']['storage']['max_concurrent_jobs'] %>" } <% @bareos_dir.each do |director| %> ########## -# Director/Monitor Resources for <%= director %> # +# Director/Monitor Resources for <%= director['bareos']['director']['name'] %> # ########## Director { - Name = <%= director['fqdn'] %>-dir - Password = "<%= node['bareos']['sd_password'] %>" + Name = "<%= director['bareos']['director']['name'] %>-dir" + Password = "<%= director['bareos']['sd_password'] %>" } Director { - Name = <%= director['fqdn'] %>-mon + Name = "<%= director['bareos']['director']['name'] %>-mon" Password = "<%= director['bareos']['mon_password'] %>" - Monitor = <%= node['bareos']['storage']['sd_mon_enable'] %> + Monitor = <%= director['bareos']['storage']['sd_mon_enable'] %> } Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <%= director['fqdn'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> + director = <%= director['bareos']['director']['name'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> } ########## diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index fd54dc1..128a925 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -1,14 +1,14 @@ <%# BCONSOLE TEMPLATE %> -# Generated by Chef for <%= node['fqdn'] %> +# Generated by Chef for <%= node['bareos']['workstation']['name'] %> # Local modifications will be overwritten. # # Bareos User Agent (or Console) Configuration File <% @bareos_dir.each do |director| %> Director { - Name = <%= director['bareos']['workstation']['name'] %>-dir + Name = <%= director['bareos']['director']['name'] %>-dir + address = <%= director['bareos']['director']['name'] %> DIRport = <%= director['bareos']['director']['dir_port'] %> - address = <%= director['bareos']['workstation']['name'] %> Password = "<%= director['bareos']['dir_password'] %>" } <% end %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index a94b938..5b595f2 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -1,15 +1,16 @@ <%# BAREOS CLIENT TEMPLATE %> -# Generated by Chef for <%= @bareos_clients['bareos']['clients']['name'] %>-fd +# Generated by Chef for <%= node['bareos']['director']['name'] %>-fd # Local modifications will be overwritten. # # Bareos Client Configuration File -<% @bareos_clients.each do |client_def| %> +<% @bareos_clients.each do |client| %> Client { - Name = <%= client_def['bareos']['clients']['name'] %>-fd + Name = <%= client['bareos']['clients']['name'] %>-fd + Address = <%= client['bareos']['clients']['name'] %> Password = "<%= client['bareos']['fd_password'] %>" # password for FileDaemon Catalog = <%= client['bareos']['database']['catalog_name'] %> - <% @client_config.each do |key, value| %> + <% @client_conf.each do |key, value| %> <%= key %> = <%= value %> <% end %> } diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index de345e6..3c3a54a 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -1,24 +1,24 @@ <%# BAREOS FILESET DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= node['bareos']['clients']['name'] %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Pool Definition File <% @fileset_config.each do |fileset_name, section| -%> FileSet { - Name = "<%= fileset_name %>-Fileset" + Name = "<%= fileset_name %>-fileset" Include { Options { - <% fileset_name['options'].each do |key1, value1| %> + <% section['options'].each do |key1, value1| %> <%= key1 %> = <%= value1 %> <% end %> } - <% fileset_name['include'].each do |key2, value2| %> + <% section['include'].each do |key2, value2| %> <%= key2 %> = <%= value2 %> <% end %> } Exclude { - <% fileset_name['exclude'].each do |key3, value3| %> + <% section['exclude'].each do |key3, value3| %> <%= key3 %> = <%= value3 %> <% end %> } diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb index 420dfeb..b2ae7ec 100644 --- a/templates/default/job_definitions.conf.erb +++ b/templates/default/job_definitions.conf.erb @@ -1,15 +1,14 @@ <%# BAREOS JOB DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= @dir_name %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Job Definitions File -<% @job_defs.each do |def_name, def_value| %> +<% @job_definitions.each do |def_name, def_value| %> JobDefs { - Name = <%= def_name %> - Type = Backup -<% def_value.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> + Name = "<%= def_name %>" + <% def_value.each do |key,value| %> + <%= key %> = <%= value %> + <% end %> } <% end %> diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 0fda555..9fa9783 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -1,14 +1,24 @@ <%# BAREOS JOBS TEMPLATE %> -# Generated by Chef for <%= @dir_name %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Jobs File -<% @bareos_client.each do |client, job| %> +<% @bareos_clients.each do |client| %> Job { Name = "<%= client['bareos']['clients']['name'] %>-Job" Client = <%= client['bareos']['clients']['name'] %>-fd - <% job.each do |key,value| %> + Type = Backup + <% @client_jobs.each do |key,value| %> + <%= key %> = <%= value %> + <% end %> +} + +Job { + Name = "<%= client['bareos']['clients']['name'] %>-Restore-Job" + Client = <%= client['bareos']['clients']['name'] %>-fd + Type = Restore + <% @client_jobs.each do |key,value| %> <%= key %> = <%= value %> <% end %> } diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb index dfa72d9..52c142a 100644 --- a/templates/default/pools.conf.erb +++ b/templates/default/pools.conf.erb @@ -8,7 +8,7 @@ Pool { Name = <%= pool_name %> <% pool.each do |key,value| %> -<%= key %> = <%= value %> + <%= key %> = <%= value %> <% end %> } <% end %> diff --git a/templates/default/schedules.conf.erb b/templates/default/schedules.conf.erb index ca4fc95..bd38e6a 100644 --- a/templates/default/schedules.conf.erb +++ b/templates/default/schedules.conf.erb @@ -1,14 +1,20 @@ <%# BAREOS SCHEDULE DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= @dir_name %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Schedule Definitions File -<% @scheds.each do |sched_name, sched| %> -Pool { - Name = <%= sched_name %> -<% sched.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> +<% @client_schedules.each do |sched_name, directive| %> +Schedule { + Name = "<%= sched_name %>" + <% directive['Run'].each do |schedules| %> + Run = <%= schedules %> + <% end %> + <% directive['Description'].each do |description| %> + Description = "<%= description %>" + <% end %> + <% directive['Enabled'].each do |enabled| %> + Enabled = <%= enabled %> + <% end %> } <% end %> diff --git a/templates/default/storages.conf.erb b/templates/default/storages.conf.erb index 5c96b6a..a577f7a 100644 --- a/templates/default/storages.conf.erb +++ b/templates/default/storages.conf.erb @@ -1,14 +1,15 @@ <%# BAREOS STORAGE DEFINITIONS TEMPLATE %> -# Generated by Chef for <%= @dir_name %>-dir +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Storage Definitions File -<% @storage_defs.each do |stor_name, stor| %> -Pool { - Name = <%= stor_name %> -<% stor.each do |key,value| %> -<%= key %> = <%= value %> -<% end %> +<% @client_storages.each do |stor_name, stor| %> +Storage { + Name = "<%= stor_name %>" + Password = "<%= node['bareos']['sd_password'] %>" + <% stor.each do |key,value| %> + <%= key %> = <%= value %> + <% end %> } <% end %> diff --git a/test/integration/roles/bareos_director.json b/test/integration/roles/bareos_director.json index a1111ee..fbbef0e 100644 --- a/test/integration/roles/bareos_director.json +++ b/test/integration/roles/bareos_director.json @@ -11,8 +11,8 @@ "role[bareos_client]", "recipe[chef-bareos::database]", "recipe[chef-bareos::server]", - "role[bareos_storage]", - "recipe[chef-bareos::workstation]" + "recipe[chef-bareos::workstation]", + "role[bareos_storage]" ], "env_run_lists": { } From 97513dccefb9099eb90644b616bc85e07e461ad6 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sun, 8 Nov 2015 02:02:33 -0800 Subject: [PATCH 136/311] forgot to do lint before last push --- attributes/default.rb | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index b5dad9a..8b1c161 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -190,7 +190,7 @@ ], 'Enabled' => [ 'yes' - ], + ] } # Storages diff --git a/metadata.rb b/metadata.rb index 56d9214..11687f2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.1' +version '2.0.2' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 492140e1aa75804694db2dca9c959b85eca01f41 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sun, 8 Nov 2015 02:17:29 -0800 Subject: [PATCH 137/311] Removing quotes on sd port, was breaking things --- templates/default/bareos-sd.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index fb626df..4de9958 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -6,7 +6,7 @@ Storage { Name = "<%= node['bareos']['storage']['name'] %>-sd" - SDPort = "<%= node['bareos']['storage']['sd_port'] %>" + SDPort = <%= node['bareos']['storage']['sd_port'] %> Maximum Concurrent Jobs = "<%= node['bareos']['storage']['max_concurrent_jobs'] %>" } From 28a0c618b8416a04229ddbd470e2bd1953033148 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sun, 8 Nov 2015 19:26:50 -0800 Subject: [PATCH 138/311] Various cleanup bits, comment cleanup, resource notifies/subscribes changes --- attributes/default.rb | 4 +- recipes/client.rb | 7 +-- recipes/database.rb | 36 ++++++------ recipes/repo.rb | 10 +--- recipes/server.rb | 61 +++++++-------------- recipes/storage.rb | 31 +++-------- recipes/workstation.rb | 10 +--- templates/default/bareos-dir.conf.erb | 8 +-- templates/default/bareos-fd.conf.erb | 8 +-- templates/default/bareos-sd.conf.erb | 16 ++---- templates/default/clients.conf.erb | 2 +- test/integration/roles/bareos_director.json | 4 +- 12 files changed, 72 insertions(+), 125 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 8b1c161..b08d89d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,11 +74,9 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] - default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 default['bareos']['clients']['heartbeat_interval'] = 600 - default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' default['bareos']['clients']['client_list'] = %w(node) default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' @@ -91,11 +89,11 @@ default['bareos']['storage']['name'] = node['fqdn'] default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' default['bareos']['storage']['sd_port'] = 9103 -default['bareos']['storage']['tape'] = false # Tape may have to be handled via custom wrapper cookbooks default['bareos']['storage']['main_storage'] = 'File' default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 +# default['bareos']['storage']['tape'] = false # Not currently supported internally to this cookbook, TBD # Director default['bareos']['director']['name'] = node['fqdn'] diff --git a/recipes/client.rb b/recipes/client.rb index 0415e47..151e224 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -18,17 +18,16 @@ # Include the OpenSSL library for generating random passwords ::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) - node.set_unless['bareos']['fd_password'] = random_password(length: 30, mode: :base64) node.set_unless['bareos']['mon_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] -dir_search_query = node.default['bareos']['director']['dir_search_query'] - # Installation of the BAREOS File Daemon +include_recipe 'chef-bareos::repo' package 'bareos-filedaemon' # Determine the list of BAREOS directors +dir_search_query = node.default['bareos']['director']['dir_search_query'] if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else @@ -44,13 +43,13 @@ variables( bareos_dir: bareos_dir ) - notifies :run, 'execute[restart-fd]', :immediately end # Allow the restart of the File Daemon with tests upfront, if called execute 'restart-fd' do command 'bareos-fd -t -c /etc/bareos/bareos-fd.conf' action :nothing + subscribes :run, 'template[/etc/bareos/bareos-fd.conf', :immediately notifies :restart, 'service[bareos-fd]', :delayed end diff --git a/recipes/database.rb b/recipes/database.rb index 137af5a..85e6347 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -16,20 +16,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Include the repo recipe, should be ok in most cases -include_recipe 'chef-bareos::repo' +# Define the type of database desired, mysql still needs some cookbook work +database = node['bareos']['database']['database_type'] -# Install the BAREOS database tools package +# Install the BAREOS database packages +include_recipe 'chef-bareos::repo' package 'bareos-database-tools' +package "bareos-database-#{database}" -# Define the type of database desired, mysql needs verified to be working -database = node['bareos']['database']['database_type'] - -# Depending on what database is used, include things +# Determine DB resources to install (psql/mysql) case database when 'postgresql' include_recipe 'postgresql::server' - package "bareos-database-#{database}" else if platform_family?('rhel') database_client_name = database.to_s @@ -40,27 +38,27 @@ end package database_client_name.to_s package database_server_name.to_s - package "bareos-database-#{database}" end # Need to add some mysql logic here to do the database setup for bareos, psql only right now, mysql is manual -if database == 'postgresql' - +case database +when 'postgresql' execute 'create_database' do - command 'su postgres -c "/usr/lib/bareos/scripts/create_bareos_database" && touch /usr/lib/bareos/.dbcreated' - creates '/usr/lib/bareos/.dbcreated' + command 'su postgres -c "/usr/lib/bareos/scripts/create_bareos_database"' action :run + not_if { node['bareos']['database']['db_created'] } end - execute 'create_tables' do - command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/make_bareos_tables" && touch /usr/lib/bareos/.dbtablescreated' - creates '/usr/lib/bareos/.dbtablescreated' + command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/make_bareos_tables"' action :run + not_if { node['bareos']['database']['db_tables_created'] } end - execute 'grant_privileges' do - command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/grant_bareos_privileges" && touch /usr/lib/bareos/.dbprivgranted' - creates '/usr/lib/bareos/.dbprivgranted' + command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/grant_bareos_privileges"' action :run + not_if { node['bareos']['database']['db_priv_granted'] } end + node.default['bareos']['database']['db_created'] = true + node.default['bareos']['database']['db_tables_created'] = true + node.default['bareos']['database']['db_priv_granted'] = true end diff --git a/recipes/repo.rb b/recipes/repo.rb index 4d90c6c..dec2fba 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -16,38 +16,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Add repos for supported platform families, else give fatal error during chef run +# Add repos for supported OS platforms, otherwise return fatal notice case node['platform_family'] when 'rhel', 'fedora' - yum_repository node['bareos']['yum_repository'] do description node['bareos']['description'] baseurl node['bareos']['baseurl'] gpgkey node['bareos']['gpgkey'] action :create end - yum_repository node['bareos']['contrib_yum_repository'] do description node['bareos']['contrib_description'] baseurl node['bareos']['contrib_baseurl'] gpgkey node['bareos']['contrib_gpgkey'] action :create end - when 'debian' - apt_repository 'bareos' do uri node['bareos']['baseurl'] components ['/'] key node['bareos']['gpgkey'] end - apt_repository 'bareos_contrib' do uri node['bareos']['contrib_baseurl'] components ['/'] key node['bareos']['contrib_gpgkey'] end - else - Chef::Log.fatal('System is not in the currently supported OS list') + Chef::Log.fatal('OS is not currently supported by this cookbook, submit enhancement request or PR') end diff --git a/recipes/server.rb b/recipes/server.rb index 1bbf245..f6cdb48 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -17,7 +17,8 @@ # limitations under the License. # By default here including both the repo and client recipes -include_recipe 'chef-bareos' +# This is just so Bareos has SOMETHING to backup (i.e. Catalog) +include_recipe 'chef-bareos::client' # Preparing Random Password for the director and mon, including OpenSSL library from client.rb node.set_unless['bareos']['dir_password'] = random_password(length: 30, mode: :base64) @@ -31,16 +32,7 @@ end end -# Create a placeholder file so BAREOS doesn't throw error when none found -file '/etc/bareos/bareos-dir.d/.conf' do - content '# This is a base file so the recipe works with no additional help' - owner 'root' - group 'root' - mode '0755' - action :create -end - -# Create the base config for the Bareos Director +# Create the core config for the Director template '/etc/bareos/bareos-dir.conf' do source 'bareos-dir.conf.erb' owner 'bareos' @@ -54,11 +46,16 @@ db_address: node['bareos']['database']['dbaddress'], dir_name: node['bareos']['director']['name'] ) - notifies :run, 'execute[restart-dir]', :delayed +end +file '/etc/bareos/bareos-dir.d/.conf' do + content '# This is a base file so the recipe works with no additional help' + owner 'root' + group 'root' + mode '0755' + action :create end -# Create clients config based on sets of hashes, see attributes file for example - +# Create clients config based on sets of hashes, see attributes file for default example(s) client_search_query = node['bareos']['clients']['client_search_query'] if Chef::Config[:solo] @@ -66,8 +63,6 @@ else bareos_clients = search(:node, client_search_query) end - -# Create clients config based on sets of hashes template '/etc/bareos/bareos-dir.d/clients.conf' do source 'clients.conf.erb' owner 'bareos' @@ -77,10 +72,9 @@ bareos_clients: bareos_clients, client_conf: node['bareos']['clients']['conf'] ) - notifies :run, 'execute[reload-dir]', :delayed end -# Create jobs config based on sets of hashes +# Create other various configs based on sets of hashes template '/etc/bareos/bareos-dir.d/jobs.conf' do source 'jobs.conf.erb' owner 'bareos' @@ -90,10 +84,7 @@ bareos_clients: bareos_clients, client_jobs: node['bareos']['clients']['jobs'] ) - notifies :run, 'execute[reload-dir]', :delayed end - -# Create job definitions config based on sets of hashes template '/etc/bareos/bareos-dir.d/job_definitions.conf' do source 'job_definitions.conf.erb' owner 'bareos' @@ -102,10 +93,7 @@ variables( job_definitions: node['bareos']['clients']['job_definitions'] ) - notifies :run, 'execute[reload-dir]', :delayed end - -# Create filesets config based on sets of hashes template '/etc/bareos/bareos-dir.d/filesets.conf' do source 'filesets.conf.erb' owner 'bareos' @@ -114,10 +102,7 @@ variables( fileset_config: node['baroes']['clients']['filesets'] ) - notifies :run, 'execute[reload-dir]', :delayed end - -# Create pools config based on sets of hashes template '/etc/bareos/bareos-dir.d/pools.conf' do source 'pools.conf.erb' owner 'bareos' @@ -126,10 +111,7 @@ variables( client_pools: node['bareos']['clients']['pools'] ) - notifies :run, 'execute[reload-dir]', :delayed end - -# Create schedules config based on sets of hashes template '/etc/bareos/bareos-dir.d/schedules.conf' do source 'schedules.conf.erb' owner 'bareos' @@ -138,10 +120,7 @@ variables( client_schedules: node['bareos']['clients']['schedules'] ) - notifies :run, 'execute[reload-dir]', :delayed end - -# Create storages config based on sets of hashes template '/etc/bareos/bareos-dir.d/storages.conf' do source 'storages.conf.erb' owner 'bareos' @@ -150,20 +129,20 @@ variables( client_storages: node['bareos']['clients']['storages'] ) - notifies :run, 'execute[reload-dir]', :delayed end # Allow a reload of the director daemon configs if called with tests up front execute 'reload-dir' do command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf" && echo reload | bconsole' action :nothing - notifies :restart, 'service[bareos-dir]', :delayed -end - -# Allow a restart of the director daemon if called with tests up front -execute 'restart-dir' do - command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' - action :nothing + subscribes :run, 'template[/etc/bareos/bareos-dir.d/storages.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/schedules.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/pools.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/filesets.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/job_definitions.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/jobs.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.d/clients.conf]', :delayed + subscribes :run, 'template[/etc/bareos/bareos-dir.conf]', :delayed notifies :restart, 'service[bareos-dir]', :delayed end diff --git a/recipes/storage.rb b/recipes/storage.rb index 12af4ed..be83e9a 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -16,33 +16,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Include the OpenSSL library by itself so it isn't dependant on the client recipe -::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) - -# Include the repo recipe by default here, should be ok under most circumstances -include_recipe 'chef-bareos::repo' - +# Include the OpenSSL cookbook library # Setup Storage Daemon Random Passwords +::Chef::Recipe.send(:include, OpenSSLCookbook::RandomPassword) node.set_unless['bareos']['sd_password'] = random_password(length: 30, mode: :base64) node.save unless Chef::Config[:solo] # Install BAREOS Storage Daemon Packages +include_recipe 'chef-bareos::repo' package 'bareos-storage' do action :install end -# Need more work on any Tape Integration -# if node['bareos']['storage']['tape'] == 'true' -# package "bareos-storage-tape" do -# action :install -# end -# end - -# Define both the bareos-sd and bareos-dir lists based on run_list searches - +# Find Storage Daemon(s) and Director(s) storage_search_query = node['bareos']['storage']['storage_search_query'] dir_search_query = node['bareos']['director']['dir_search_query'] - if Chef::Config[:solo] bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] @@ -51,7 +39,7 @@ bareos_dir = search(:node, dir_search_query) end -# Setup the bareos-sd config +# SD Config template '/etc/bareos/bareos-sd.conf' do source 'bareos-sd.conf.erb' mode 0640 @@ -61,7 +49,6 @@ bareos_sd: bareos_sd, bareos_dir: bareos_dir ) - notifies :run, 'execute[restart-sd]', :delayed end # Create the custom config directory @@ -70,17 +57,17 @@ group 'root' mode '0755' action :create - notifies :run, 'execute[restart-sd]', :delayed end -# If called restart the bareos-sd confg(s) with a test first +# Test Config before restarting SD execute 'restart-sd' do command 'bareos-sd -t -c /etc/bareos/bareos-sd.conf' action :nothing - notifies :restart, 'service[bareos-sd]', :immediately + subscribes :run, 'template[/etc/bareos/bareos-sd.conf]', :immediately + notifies :restart, 'service[bareos-sd]', :delayed end -# Start and enable the bareos-sd service and run if called elsewhere +# Start and enable SD service service 'bareos-sd' do supports status: true, restart: true, reload: false action [:enable, :start] diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 994efcb..6147de3 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -16,25 +16,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Repo recipe is needed to install, so include by default, ok in most cases -include_recipe 'chef-bareos::repo' - # Install bconsole from repo +include_recipe 'chef-bareos::repo' package 'bareos-bconsole' do action :install end -# Define the list of bareos directors - +# Find director(s) dir_search_query = node['bareos']['director']['dir_search_query'] - if Chef::Config[:solo] bareos_dir = node['bareos']['director']['servers'] else bareos_dir = search(:node, dir_search_query) end -# Setup the bconsole config, pushes out list of bareos-dirs and if solo mode +# bconsole config template '/etc/bareos/bconsole.conf' do source 'bconsole.conf.erb' mode 0640 diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index da30738..091b1e9 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -58,12 +58,12 @@ Schedule { ################### Catalog { Name = <%= node['bareos']['database']['catalog_name'] %> - dbdriver = "<%= @db_driver %>" - dbname = "<%= @db_name %>" - dbuser = "<%= @db_user %>" + dbdriver = <%= @db_driver %> + dbname = <%= @db_name %> + dbuser = <%= @db_user %> dbpassword = "<%= @db_password %>" <% if @db_address != nil %> - dbaddress = "<%= @db_address %>" + dbaddress = <%= @db_address %> <% end %> } diff --git a/templates/default/bareos-fd.conf.erb b/templates/default/bareos-fd.conf.erb index f646f65..945db27 100644 --- a/templates/default/bareos-fd.conf.erb +++ b/templates/default/bareos-fd.conf.erb @@ -13,21 +13,21 @@ FileDaemon { <% @bareos_dir.each do |director| %> ########## -# Director/Monitor Resources for <%= director['fqdn'] %> +# Director/Monitor Resources for <%= director['bareos']['director']['name'] %> ########## Director { - Name = <%= director['fqdn'] %>-dir + Name = <%= director['bareos']['director']['name'] %>-dir Password = "<%= node['bareos']['fd_password'] %>" } Director { - Name = <%= director['fqdn'] %>-mon + Name = <%= director['bareos']['director']['name'] %>-mon Password = "<%= director['bareos']['mon_password'] %>" Monitor = <%= node['bareos']['storage']['sd_mon_enable'] %> } Messages { Name = <%= node['bareos']['messages']['default_messages'] %> - director = <%= director['fqdn'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> + director = <%= director['bareos']['director']['name'] %>-dir = <%= node['bareos']['messages']['default_admin_messages'] %> } <% end %> diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 4de9958..0db65bf 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -5,22 +5,20 @@ # Bareos Storage Daemon Configuration File# Storage { - Name = "<%= node['bareos']['storage']['name'] %>-sd" + Name = <%= node['bareos']['storage']['name'] %>-sd SDPort = <%= node['bareos']['storage']['sd_port'] %> - Maximum Concurrent Jobs = "<%= node['bareos']['storage']['max_concurrent_jobs'] %>" + Maximum Concurrent Jobs = <%= node['bareos']['storage']['max_concurrent_jobs'] %> } <% @bareos_dir.each do |director| %> -########## -# Director/Monitor Resources for <%= director['bareos']['director']['name'] %> # -########## +# Director/Monitor Resources for <%= director['bareos']['director']['name'] %> Director { - Name = "<%= director['bareos']['director']['name'] %>-dir" + Name = <%= director['bareos']['director']['name'] %>-dir Password = "<%= director['bareos']['sd_password'] %>" } Director { - Name = "<%= director['bareos']['director']['name'] %>-mon" + Name = <%= director['bareos']['director']['name'] %>-mon Password = "<%= director['bareos']['mon_password'] %>" Monitor = <%= director['bareos']['storage']['sd_mon_enable'] %> } @@ -31,7 +29,7 @@ Messages { } ########## -<% end %> +<% end -%> Device { Name = FileStorage @@ -43,11 +41,9 @@ Device { AlwaysOpen = no; LabelMedia = yes } -<% if node['bareos']['storage']['custom_configs'] == '1' %> ######################################## # Custom Storage Daemon Config Locations ######################################## @|"sh -c 'for f in /etc/bareos/bareos-sd.d/*.conf ; do echo @${f} ; done'" -<% end %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 5b595f2..c7d320e 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -1,5 +1,5 @@ <%# BAREOS CLIENT TEMPLATE %> -# Generated by Chef for <%= node['bareos']['director']['name'] %>-fd +# Generated by Chef for <%= node['bareos']['director']['name'] %>-dir # Local modifications will be overwritten. # # Bareos Client Configuration File diff --git a/test/integration/roles/bareos_director.json b/test/integration/roles/bareos_director.json index fbbef0e..378b6f4 100644 --- a/test/integration/roles/bareos_director.json +++ b/test/integration/roles/bareos_director.json @@ -10,9 +10,9 @@ "run_list": [ "role[bareos_client]", "recipe[chef-bareos::database]", + "role[bareos_storage]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::workstation]", - "role[bareos_storage]" + "recipe[chef-bareos::workstation]" ], "env_run_lists": { } From 84072737ac5490023ec94f4482cb539f4f57558d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 9 Nov 2015 15:03:52 -0800 Subject: [PATCH 139/311] cleanup, organization updates, consistency issues --- attributes/default.rb | 2 +- recipes/client.rb | 2 +- recipes/database.rb | 15 ++++++-------- recipes/server.rb | 30 ++++++++++++++++++---------- recipes/storage.rb | 27 ++++++++++++++++--------- templates/default/bareos-sd.conf.erb | 2 +- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index b08d89d..53af3b9 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -5,7 +5,7 @@ # Used to have 'latest' as default, had potential update dangers # default['bareos']['version'] = 'latest' <--- Could be dangerous, ***CAUTION*** -default['bareos']['version'] = '14.2' # <--- Latest Stable version as of 6-26-15 +default['bareos']['version'] = '14.2' # <--- Latest Stable version as of 05-Jan-2015 if platform_family?('rhel', 'fedora') default['bareos']['yum_repository'] = 'bareos' diff --git a/recipes/client.rb b/recipes/client.rb index 151e224..dd65d65 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -56,5 +56,5 @@ # Start and enable the BAREOS File Daemon service 'bareos-fd' do supports status: true, restart: true, reload: false - action [:enable, :start] + action :enable end diff --git a/recipes/database.rb b/recipes/database.rb index 85e6347..3d5ae7c 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -44,21 +44,18 @@ case database when 'postgresql' execute 'create_database' do - command 'su postgres -c "/usr/lib/bareos/scripts/create_bareos_database"' + command 'su postgres -c /usr/lib/bareos/scripts/create_bareos_database && touch /usr/lib/bareos/.dbcreated' + creates '/usr/lib/bareos/.dbcreated' action :run - not_if { node['bareos']['database']['db_created'] } end execute 'create_tables' do - command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/make_bareos_tables"' + command 'su postgres -s /bin/bash -c /usr/lib/bareos/scripts/make_bareos_tables && touch /usr/lib/bareos/.dbtablescreated' + creates '/usr/lib/bareos/.dbtablescreated' action :run - not_if { node['bareos']['database']['db_tables_created'] } end execute 'grant_privileges' do - command 'su postgres -s /bin/bash -c "/usr/lib/bareos/scripts/grant_bareos_privileges"' + command 'su postgres -s /bin/bash -c /usr/lib/bareos/scripts/grant_bareos_privileges && touch /usr/lib/bareos/.dbprivgranted' + creates '/usr/lib/bareos/.dbprivgranted' action :run - not_if { node['bareos']['database']['db_priv_granted'] } end - node.default['bareos']['database']['db_created'] = true - node.default['bareos']['database']['db_tables_created'] = true - node.default['bareos']['database']['db_priv_granted'] = true end diff --git a/recipes/server.rb b/recipes/server.rb index f6cdb48..df3dc7b 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -32,7 +32,23 @@ end end -# Create the core config for the Director +# Create the custom config directory and placeholder file +directory '/etc/bareos/bareos-dir.d' do + owner 'root' + group 'root' + mode '0755' + action :create +end + +file '/etc/bareos/bareos-dir.d/dir_helper.conf' do + content '# This is a base file so the recipe works with no additional help' + owner 'root' + group 'root' + mode '0755' + action :create +end + +# Director Config template '/etc/bareos/bareos-dir.conf' do source 'bareos-dir.conf.erb' owner 'bareos' @@ -46,13 +62,7 @@ db_address: node['bareos']['database']['dbaddress'], dir_name: node['bareos']['director']['name'] ) -end -file '/etc/bareos/bareos-dir.d/.conf' do - content '# This is a base file so the recipe works with no additional help' - owner 'root' - group 'root' - mode '0755' - action :create + only_if { File.exist?('/etc/bareos/bareos-dir.d/dir_helper.conf') } end # Create clients config based on sets of hashes, see attributes file for default example(s) @@ -133,7 +143,7 @@ # Allow a reload of the director daemon configs if called with tests up front execute 'reload-dir' do - command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf" && echo reload | bconsole' + command 'su - bareos -s /bin/sh -c "/usr/sbin/bareos-dir -t -c /etc/bareos/bareos-dir.conf"' action :nothing subscribes :run, 'template[/etc/bareos/bareos-dir.d/storages.conf]', :delayed subscribes :run, 'template[/etc/bareos/bareos-dir.d/schedules.conf]', :delayed @@ -149,5 +159,5 @@ # Enable and start the bareos-dir service service 'bareos-dir' do supports status: true, restart: true, reload: false - action [:enable, :start] + action :enable end diff --git a/recipes/storage.rb b/recipes/storage.rb index be83e9a..25431e0 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -39,6 +39,22 @@ bareos_dir = search(:node, dir_search_query) end +# Create the custom config directory and placeholder file +directory '/etc/bareos/bareos-sd.d' do + owner 'root' + group 'bareos' + mode '0755' + action :create +end + +file '/etc/bareos/bareos-sd.d/sd_helper.conf' do + content '# This is a base file so the recipe works with no additional help' + owner 'root' + group 'bareos' + mode '0755' + action :create +end + # SD Config template '/etc/bareos/bareos-sd.conf' do source 'bareos-sd.conf.erb' @@ -49,14 +65,7 @@ bareos_sd: bareos_sd, bareos_dir: bareos_dir ) -end - -# Create the custom config directory -directory '/etc/bareos/bareos-sd.d' do - owner 'root' - group 'root' - mode '0755' - action :create + only_if { File.exist?('/etc/bareos/bareos-sd.d/sd_helper.conf') } end # Test Config before restarting SD @@ -70,5 +79,5 @@ # Start and enable SD service service 'bareos-sd' do supports status: true, restart: true, reload: false - action [:enable, :start] + action :enable end diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 0db65bf..14cdc5a 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -46,4 +46,4 @@ Device { # Custom Storage Daemon Config Locations ######################################## -@|"sh -c 'for f in /etc/bareos/bareos-sd.d/*.conf ; do echo @${f} ; done'" +@|"sh -c 'for conf in /etc/bareos/bareos-sd.d/*.conf ; do echo @${conf} ; done'" From 0dc0b3ea6d308a7cc150f9cc8a624bf3f3b54845 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 9 Nov 2015 15:34:14 -0800 Subject: [PATCH 140/311] fixing typo --- recipes/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/client.rb b/recipes/client.rb index dd65d65..f0c155d 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -49,7 +49,7 @@ execute 'restart-fd' do command 'bareos-fd -t -c /etc/bareos/bareos-fd.conf' action :nothing - subscribes :run, 'template[/etc/bareos/bareos-fd.conf', :immediately + subscribes :run, 'template[/etc/bareos/bareos-fd.conf]', :immediately notifies :restart, 'service[bareos-fd]', :delayed end From 3d554e62f8f2ec54d92501df279aba54a19e05d2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 10 Nov 2015 14:18:02 -0800 Subject: [PATCH 141/311] fixing some premissions --- metadata.rb | 2 +- recipes/server.rb | 2 +- recipes/storage.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata.rb b/metadata.rb index 11687f2..80c58c1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.2' +version '2.0.3' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index df3dc7b..fe9205d 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -44,7 +44,7 @@ content '# This is a base file so the recipe works with no additional help' owner 'root' group 'root' - mode '0755' + mode '0644' action :create end diff --git a/recipes/storage.rb b/recipes/storage.rb index 25431e0..a59d68a 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -51,7 +51,7 @@ content '# This is a base file so the recipe works with no additional help' owner 'root' group 'bareos' - mode '0755' + mode '0644' action :create end From c6235aed6e94cab42d24454572536b63a57af2b2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 10 Nov 2015 14:31:55 -0800 Subject: [PATCH 142/311] found bug with jobs/jobdefs per client, also don't want sched on restore --- attributes/default.rb | 13 +++++++++++++ recipes/server.rb | 3 ++- templates/default/jobs.conf.erb | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 53af3b9..411e529 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -129,6 +129,10 @@ 'JobDefs' => 'default-def' } +default['bareos']['clients']['restore_jobs'] = { + 'JobDefs' => 'default-restore-def' +} + # Job Definitions default['bareos']['clients']['job_definitions']['default-def'] = { 'Level' => 'Incremental', @@ -142,6 +146,15 @@ 'SpoolData' => 'no' } +default['bareos']['clients']['job_definitions']['default-restore-def'] = { + 'Fileset' => 'default-fileset', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Priority' => '7', + 'Where' => '/tmp/bareos-restores' +} + # Filesets default['baroes']['clients']['filesets']['default'] = { 'options' => { diff --git a/recipes/server.rb b/recipes/server.rb index fe9205d..688cdc9 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -92,7 +92,8 @@ mode '0640' variables( bareos_clients: bareos_clients, - client_jobs: node['bareos']['clients']['jobs'] + client_jobs: node['bareos']['clients']['jobs'], + client_restore_jobs: node['bareos']['clients']['restore_jobs'] ) end template '/etc/bareos/bareos-dir.d/job_definitions.conf' do diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 9fa9783..d8bb2b2 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -18,7 +18,7 @@ Job { Name = "<%= client['bareos']['clients']['name'] %>-Restore-Job" Client = <%= client['bareos']['clients']['name'] %>-fd Type = Restore - <% @client_jobs.each do |key,value| %> + <% @client_restore_jobs.each do |key1,value2| %> <%= key %> = <%= value %> <% end %> } From dfc5e868d3e8ab2f53777aaf76a3a07d5c8613fa Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 10 Nov 2015 14:35:32 -0800 Subject: [PATCH 143/311] typos --- templates/default/jobs.conf.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index d8bb2b2..dbb9ebc 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -9,8 +9,8 @@ Job { Name = "<%= client['bareos']['clients']['name'] %>-Job" Client = <%= client['bareos']['clients']['name'] %>-fd Type = Backup - <% @client_jobs.each do |key,value| %> - <%= key %> = <%= value %> + <% @client_jobs.each do |key1,value1| %> + <%= key1 %> = <%= value1 %> <% end %> } @@ -18,8 +18,8 @@ Job { Name = "<%= client['bareos']['clients']['name'] %>-Restore-Job" Client = <%= client['bareos']['clients']['name'] %>-fd Type = Restore - <% @client_restore_jobs.each do |key1,value2| %> - <%= key %> = <%= value %> + <% @client_restore_jobs.each do |key2,value2| %> + <%= key2 %> = <%= value2 %> <% end %> } From 2436fc887e28b5ef45f04392541169bbd59c3701 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 10 Nov 2015 14:35:55 -0800 Subject: [PATCH 144/311] Typo bump --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 80c58c1..acaf061 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.3' +version '2.0.4' %w( centos redhat ).each do |os| supports os, '>= 6.0' From c5c1090d0596700c874f79ef86a46738ee5df119 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 21 Dec 2015 17:00:00 -0800 Subject: [PATCH 145/311] hack until I can get logic right --- metadata.rb | 2 +- templates/default/filesets.conf.erb | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index acaf061..55ff478 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.4' +version '2.0.5' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index 3c3a54a..ade4c61 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -14,12 +14,15 @@ FileSet { <% end %> } <% section['include'].each do |key2, value2| %> - <%= key2 %> = <%= value2 %> + File = <%= value2 %> + <% end %> + <% section['other_conf'].each do |key3, value3] %> + <%= key3 %> = <%= value3 %> <% end %> } Exclude { - <% section['exclude'].each do |key3, value3| %> - <%= key3 %> = <%= value3 %> + <% section['exclude'].each do |key4, value4| %> + <%= key4 %> = <%= value4 %> <% end %> } } From 99ee695e4b830ea984fc6e96a21747976de26f96 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 21 Dec 2015 17:14:19 -0800 Subject: [PATCH 146/311] typo --- templates/default/filesets.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index ade4c61..4686912 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -16,7 +16,7 @@ FileSet { <% section['include'].each do |key2, value2| %> File = <%= value2 %> <% end %> - <% section['other_conf'].each do |key3, value3] %> + <% section['other_conf'].each do |key3, value3| %> <%= key3 %> = <%= value3 %> <% end %> } From 3ab459365cdf3cbf9d4813e15aaf257e21804681 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 22 Dec 2015 14:32:18 -0800 Subject: [PATCH 147/311] needed another layer to handle deep hash --- templates/default/filesets.conf.erb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index 4686912..d77ed2b 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -14,15 +14,16 @@ FileSet { <% end %> } <% section['include'].each do |key2, value2| %> - File = <%= value2 %> - <% end %> - <% section['other_conf'].each do |key3, value3| %> - <%= key3 %> = <%= value3 %> + <% value2.each do |v2| %> + <%= key2 %> = <%= v2 %> + <% end %> <% end %> } Exclude { - <% section['exclude'].each do |key4, value4| %> - <%= key4 %> = <%= value4 %> + <% section['exclude'].each do |key3, value3| %> + <% value3.each do |v3| %> + <%= key3 %> = <%= v3 %> + <% end %> <% end %> } } From 23773ecc40b36976d8aa609d1ac83eea33fab4ea Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 22 Dec 2015 14:33:11 -0800 Subject: [PATCH 148/311] bumping to handle deeper hashing --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 55ff478..8f354e1 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.5' +version '2.0.6' %w( centos redhat ).each do |os| supports os, '>= 6.0' From de594be92361bc6cfe4809eb40b55fd42f5a81de Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 22 Dec 2015 14:46:44 -0800 Subject: [PATCH 149/311] I think this should be the fix --- templates/default/filesets.conf.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index d77ed2b..2b2543a 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -14,14 +14,14 @@ FileSet { <% end %> } <% section['include'].each do |key2, value2| %> - <% value2.each do |v2| %> + <% @value2.each do |v2| %> <%= key2 %> = <%= v2 %> <% end %> <% end %> } Exclude { <% section['exclude'].each do |key3, value3| %> - <% value3.each do |v3| %> + <% @value3.each do |v3| %> <%= key3 %> = <%= v3 %> <% end %> <% end %> From 7611717864269c53501f7967e9715025912c217d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 22 Dec 2015 16:14:46 -0800 Subject: [PATCH 150/311] There, now that works, make sure to document the lists requirement in the hashing for filesets --- attributes/default.rb | 4 ++-- templates/default/filesets.conf.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 411e529..92fa87e 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -161,8 +161,8 @@ 'signature' => 'MD5' }, 'include' => { - 'File' => '/', - 'Exclude Dir Containing' => '.bareos_ignore' + 'File' => ['/','/home'], + 'Exclude Dir Containing' => ['.bareos_ignore'] }, 'exclude' => { 'File' => [ diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index 2b2543a..d77ed2b 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -14,14 +14,14 @@ FileSet { <% end %> } <% section['include'].each do |key2, value2| %> - <% @value2.each do |v2| %> + <% value2.each do |v2| %> <%= key2 %> = <%= v2 %> <% end %> <% end %> } Exclude { <% section['exclude'].each do |key3, value3| %> - <% @value3.each do |v3| %> + <% value3.each do |v3| %> <%= key3 %> = <%= v3 %> <% end %> <% end %> From 977ee2234c1b6fa0c3448c149a7181979926e863 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 22 Dec 2015 16:15:06 -0800 Subject: [PATCH 151/311] fix for fileset bug --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 8f354e1..08f50a6 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.6' +version '2.0.7' %w( centos redhat ).each do |os| supports os, '>= 6.0' From f73b107b5d6ca4c73260abb2916ca40d6ee0063f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 24 Dec 2015 01:13:48 -0800 Subject: [PATCH 152/311] fixing a template bug for subscriptions in dir config --- metadata.rb | 2 +- templates/default/bareos-dir.conf.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 08f50a6..25cfef0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.7' +version '2.0.8' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 091b1e9..a6dd936 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -16,7 +16,7 @@ Director { Messages = Daemon Heartbeat Interval = <%= node['bareos']['director']['heartbeat_interval'] %> <% if node['bareos']['director']['dir_subscription'] == true %> - Subscriptions = <%= node['bareos']['dir_subs'] %> + Subscriptions = <%= node['bareos']['director']['dir_subs'] %> <% end %> } From 0ec0c369b6384874b9721bb427dffa33d551a2f4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Dec 2015 15:55:53 -0800 Subject: [PATCH 153/311] adding some tests for autochanger configs --- .kitchen.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index d9a6f4b..51f14a5 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -28,3 +28,10 @@ suites: run_list: - role[bareos_director] attributes: + - name: tape-storage + run_list: + - role[bareos_director] + attributes: + bareos: + storage: + autochanger_enabled: true From 66656eafc7933c7802ca9f4457fc466f498fff56 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Dec 2015 15:57:08 -0800 Subject: [PATCH 154/311] adding an example autochanger device hash --- attributes/default.rb | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 92fa87e..6d43a04 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -93,7 +93,7 @@ default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 -# default['bareos']['storage']['tape'] = false # Not currently supported internally to this cookbook, TBD +# default['bareos']['storage']['autochanger_enabled'] = false # Experimental, Limited Support # Director default['bareos']['director']['name'] = node['fqdn'] @@ -161,7 +161,7 @@ 'signature' => 'MD5' }, 'include' => { - 'File' => ['/','/home'], + 'File' => ['/', '/home'], 'Exclude Dir Containing' => ['.bareos_ignore'] }, 'exclude' => { @@ -210,3 +210,24 @@ 'Device' => 'FileStorage', 'Media Type' => 'File' } + +default['bareos']['storage']['autochanger']['default-devices'] = { + 'autochanger' => { + 'autochanger-0' => { + 'Changer Device' => '/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER', + 'Device' => 'tapedrive-0', + 'Changer Command' => '"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"' + } + }, + 'device' => { + 'tapedrive-0' => { + 'DeviceType' => 'tape', + 'DriveIndex' => '0', + 'ArchiveDevice' => 'dev/nst0', + 'MediaType' => 'lto', + 'Autochanger' => 'no', + 'AutomaticMount' => 'no', + 'MaximumFileSize' => '10GB' + } + } +} From cadb1f5ec291e5d9ed3beee0cb12e1191073b986 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Dec 2015 15:59:00 -0800 Subject: [PATCH 155/311] moving the autochanger stuff to its own recipe for ease of edits --- recipes/storage.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/storage.rb b/recipes/storage.rb index a59d68a..4276b8d 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -68,6 +68,9 @@ only_if { File.exist?('/etc/bareos/bareos-sd.d/sd_helper.conf') } end +# Experimental Tape Autochanger Support +include_recipe 'chef-bareos::autochanger' if node['bareos']['storage']['autochanger_enabled'] + # Test Config before restarting SD execute 'restart-sd' do command 'bareos-sd -t -c /etc/bareos/bareos-sd.conf' From 0d4496e548e5990111964435ed51db1f05e6d804 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Dec 2015 15:59:45 -0800 Subject: [PATCH 156/311] adding in some autochanger config bits, work in progress but testing well so far --- recipes/autochanger.rb | 39 ++++++++ .../device-tape-with-autoloader.conf.erb | 61 +++++++++++++ .../tape-storage/serverspec/.rspec | 2 + .../tape-storage/serverspec/bareos_spec.rb | 30 +++++++ .../serverspec/spec/spec_helper.rb | 89 +++++++++++++++++++ .../tape-storage/serverspec/spec_helper.rb | 16 ++++ 6 files changed, 237 insertions(+) create mode 100644 recipes/autochanger.rb create mode 100644 templates/default/device-tape-with-autoloader.conf.erb create mode 100644 test/integration/tape-storage/serverspec/.rspec create mode 100644 test/integration/tape-storage/serverspec/bareos_spec.rb create mode 100644 test/integration/tape-storage/serverspec/spec/spec_helper.rb create mode 100644 test/integration/tape-storage/serverspec/spec_helper.rb diff --git a/recipes/autochanger.rb b/recipes/autochanger.rb new file mode 100644 index 0000000..7e58b2f --- /dev/null +++ b/recipes/autochanger.rb @@ -0,0 +1,39 @@ +# encoding: UTF-8 +# Cookbook Name:: bareos +# Recipe:: autochanger +# +# Copyright (C) 2014 Leonard TAVAE +# +# 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. + +# Experimental Tape Autochanger Support +package 'bareos-storage-tape' + +execute 'mtx-changer' do + command '/usr/bin/bareos/scripts/mtx-changer' + creates '/etc/bareos/mtx-changer.conf' + action :run +end + +template '/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf' do + source 'device-tape-with-autoloader.conf.erb' + owner 'bareos' + group 'bareos' + mode '0640' + variables( + autochanger: node['bareos']['storage']['autochanger'] + ) + only_if { File.exist?('/etc/bareos/mtx-changer.conf') } + notifies :restart, 'service[bareos-sd]', :delayed + action :create +end diff --git a/templates/default/device-tape-with-autoloader.conf.erb b/templates/default/device-tape-with-autoloader.conf.erb new file mode 100644 index 0000000..f362c52 --- /dev/null +++ b/templates/default/device-tape-with-autoloader.conf.erb @@ -0,0 +1,61 @@ +<%# BAREOS TAPE AUTOLOADER DEFINITIONS TEMPLATE %> +# Generated by Chef for <%= node['bareos']['storage']['name'] %> +# Local modifications will be overwritten. +# +# Bareos Autochanger Definition File + +# Preparations: +# +# include this configuration file in bareos-sd.conf by +# @/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf +# + +# on Linux use "lsscsi --generic" +# to get a list of your SCSI devices. +# However, normaly you should access your devices by-id +# (eg. /dev/tape/by-id/scsi-350011d00018a5f03-nst), +# because the short device names like /dev/nst1 +# might change on reboot. + +#### Other Default comment lines from default config #### +# DriveIndex = 0 #default:0, only required if the autoloader have multiple drives. + +# if only one drive is available, this is normally /dev/nst0. + # However, it is advised to access it via id (/dev/tape/by-id/...) + #ArchiveDevice = /dev/nst0 + #ArchiveDevice = /dev/tape/by-id/scsi-350011d00018a5f03-nst + # arbitrary string that descripes the the storage media. + # Bareos uses this to determine, which device can be handle what media. + +# enable "Check Labels" if tapes with ANSI/IBM labels + # should be preserved + #Check Labels = yes + +#AutoChanger = yes # default: no + #AutomaticMount = yes # default: no + #MaximumFileSize = 10GB # default: 1000000000 (1GB) +#### + +<%# AutoChanger Config -%> +<% @autochanger.each do |autochanger_key, section| -%> + + <% section['autochanger'].each do |ac_key, ac_property| -%> +Autochanger { + Name = "<%= ac_key %>" + Description = "Chef Defined <%= autochanger_key %>/<%= ac_key %> Autochanger" + <% ac_property.each do |key1, value1| %> + <%= key1 %> = <%= value1 %> + <% end %> +} + <% end %> + + <% section['device'].each do |dev_key, dev_property| -%> +Device { + Name = "<%= dev_key %>" + Description = "Chef Defined <%= autochanger_key %>/<%= dev_key %> Device" + <% dev_property.each do |key2, value2| %> + <%= key2 %> = <%= value2 %> + <% end %> +} + <% end %> +<% end %> diff --git a/test/integration/tape-storage/serverspec/.rspec b/test/integration/tape-storage/serverspec/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/test/integration/tape-storage/serverspec/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/test/integration/tape-storage/serverspec/bareos_spec.rb b/test/integration/tape-storage/serverspec/bareos_spec.rb new file mode 100644 index 0000000..b6b14ce --- /dev/null +++ b/test/integration/tape-storage/serverspec/bareos_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +# Check Packages are installed +describe package('bareos-filedaemon') do + it { should be_installed } +end + +describe package('bareos-storage') do + it { should be_installed } +end + +describe package('bareos-director') do + it { should be_installed } +end + +# Check Services are running and enabled +describe service('bareos-fd') do + it { should be_enabled } + it { should be_running } +end + +describe service('bareos-sd') do + it { should be_enabled } + it { should be_running } +end + +describe service('bareos-dir') do + it { should be_enabled } + it { should be_running } +end diff --git a/test/integration/tape-storage/serverspec/spec/spec_helper.rb b/test/integration/tape-storage/serverspec/spec/spec_helper.rb new file mode 100644 index 0000000..3c0aae9 --- /dev/null +++ b/test/integration/tape-storage/serverspec/spec/spec_helper.rb @@ -0,0 +1,89 @@ +# This file was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause this +# file to always be loaded, without a need to explicitly require it in any files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # The settings below are suggested to provide a good initial experience + # with RSpec, but feel free to customize to your heart's content. + begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Limits the available syntax to the non-monkey patched syntax that is recommended. + # For more details, see: + # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax + # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed + end +end diff --git a/test/integration/tape-storage/serverspec/spec_helper.rb b/test/integration/tape-storage/serverspec/spec_helper.rb new file mode 100644 index 0000000..8763eb5 --- /dev/null +++ b/test/integration/tape-storage/serverspec/spec_helper.rb @@ -0,0 +1,16 @@ +require 'serverspec' + +set :backend, :exec + +RSpec.configure do |c| + c.before :all do + set :path, '$PATH:/sbin:/usr/local/sbin' + end + + if ENV['ASK_SUDO_PASSWORD'] + require 'highline/import' + c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false } + else + c.sudo_password = ENV['SUDO_PASSWORD'] + end +end From 51fc0af21ef3c80b2c1f8f6a6a0a53fb711e008b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 28 Dec 2015 16:00:36 -0800 Subject: [PATCH 157/311] adding new major feature, tape/autochanger support, work in progress --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 25cfef0..95bab35 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.0.8' +version '2.1.1' %w( centos redhat ).each do |os| supports os, '>= 6.0' From e458b14dbc53d5fa0f4c329ec9f5416e2fe8b304 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 7 Jan 2016 18:51:51 -0800 Subject: [PATCH 158/311] Refactoring for ease of use and readability. Plus..it works --- .kitchen.yml | 3 +- attributes/default.rb | 58 +++++++++++++------ recipes/autochanger.rb | 3 +- .../device-tape-with-autoloader.conf.erb | 31 +++++----- 4 files changed, 59 insertions(+), 36 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 51f14a5..e3d232f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -4,7 +4,7 @@ driver: provisioner: name: chef_zero - require_chef_omnibus: latest + require_chef_omnibus: 12.6.0 platforms: - name: debian-7.8 @@ -35,3 +35,4 @@ suites: bareos: storage: autochanger_enabled: true + test_mode: true diff --git a/attributes/default.rb b/attributes/default.rb index 6d43a04..ba8ff3c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -211,23 +211,43 @@ 'Media Type' => 'File' } -default['bareos']['storage']['autochanger']['default-devices'] = { - 'autochanger' => { - 'autochanger-0' => { - 'Changer Device' => '/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER', - 'Device' => 'tapedrive-0', - 'Changer Command' => '"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"' - } - }, - 'device' => { - 'tapedrive-0' => { - 'DeviceType' => 'tape', - 'DriveIndex' => '0', - 'ArchiveDevice' => 'dev/nst0', - 'MediaType' => 'lto', - 'Autochanger' => 'no', - 'AutomaticMount' => 'no', - 'MaximumFileSize' => '10GB' - } +# Developing Feature - Tape Autochanger Devices +default['bareos']['storage']['test_mode'] = false +if node.default['bareos']['storage']['test_mode'] = true + default['bareos']['storage']['autochangers']['autochanger-0'] = { + 'Device' => [ + 'tapedrive-0', + 'tapedrive-1' + ], + 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], + 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] } -} + + default['bareos']['storage']['autochangers']['autochanger-1'] = { + 'Device' => [ + 'tapedrive-0' + ], + 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], + 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] + } + + default['bareos']['storage']['devices']['tapedrive-0'] = { + 'DeviceType' => 'tape', + 'DriveIndex' => '0', + 'ArchiveDevice' => 'dev/nst0', + 'MediaType' => 'lto', + 'Autochanger' => 'no', + 'AutomaticMount' => 'no', + 'MaximumFileSize' => '10GB' + } + + default['bareos']['storage']['devices']['tapedrive-1'] = { + 'DeviceType' => 'tape', + 'DriveIndex' => '0', + 'ArchiveDevice' => 'dev/nst0', + 'MediaType' => 'lto', + 'Autochanger' => 'no', + 'AutomaticMount' => 'no', + 'MaximumFileSize' => '10GB' + } +end diff --git a/recipes/autochanger.rb b/recipes/autochanger.rb index 7e58b2f..fa3ff7d 100644 --- a/recipes/autochanger.rb +++ b/recipes/autochanger.rb @@ -31,7 +31,8 @@ group 'bareos' mode '0640' variables( - autochanger: node['bareos']['storage']['autochanger'] + autochangers: node['bareos']['storage']['autochangers'], + devices: node['bareos']['storage']['devices'] ) only_if { File.exist?('/etc/bareos/mtx-changer.conf') } notifies :restart, 'service[bareos-sd]', :delayed diff --git a/templates/default/device-tape-with-autoloader.conf.erb b/templates/default/device-tape-with-autoloader.conf.erb index f362c52..3546f74 100644 --- a/templates/default/device-tape-with-autoloader.conf.erb +++ b/templates/default/device-tape-with-autoloader.conf.erb @@ -36,26 +36,27 @@ #MaximumFileSize = 10GB # default: 1000000000 (1GB) #### -<%# AutoChanger Config -%> -<% @autochanger.each do |autochanger_key, section| -%> - - <% section['autochanger'].each do |ac_key, ac_property| -%> +<%# AutoChanger Config %> +<% @autochangers.each do |autochanger_key, line_value1| %> Autochanger { - Name = "<%= ac_key %>" - Description = "Chef Defined <%= autochanger_key %>/<%= ac_key %> Autochanger" - <% ac_property.each do |key1, value1| %> - <%= key1 %> = <%= value1 %> + Name = "<%= autochanger_key %>" + Description = "<%= autochanger_key %> Defined by Chef" + <% line_value1.each do |key1, value1| %> + <% value1.each do |v1| %> + <%= key1 %> = <%= v1 %> <% end %> -} <% end %> +} - <% section['device'].each do |dev_key, dev_property| -%> +<% end %> +<%# Device Config %> +<% @devices.each do |device_key, line_value2| %> Device { - Name = "<%= dev_key %>" - Description = "Chef Defined <%= autochanger_key %>/<%= dev_key %> Device" - <% dev_property.each do |key2, value2| %> + Name = "<%= device_key %>" + Description = "<%= device_key %> Defined by Chef" + <% line_value2.each do |key2, value2| %> <%= key2 %> = <%= value2 %> - <% end %> -} <% end %> +} + <% end %> From de56a5961f28fc7ed75cb1a803e231750000826f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 7 Jan 2016 18:53:39 -0800 Subject: [PATCH 159/311] adding working base support for autochangers, still semi-experimental but functional, will flush out more issues as they come along --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 95bab35..c765a99 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.1' +version '2.1.2' %w( centos redhat ).each do |os| supports os, '>= 6.0' From a0071b41ef65087947bc60435c34e9f98b3a9df8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 7 Jan 2016 19:10:31 -0800 Subject: [PATCH 160/311] putting temporary limitation on postgresql cookbook --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c765a99..a4ce660 100644 --- a/metadata.rb +++ b/metadata.rb @@ -16,5 +16,5 @@ depends 'apt' depends 'openssl' -depends 'postgresql' +depends 'postgresql', '< 4.0.0' depends 'yum' From 7a51347e2435060bb29112db90392df296d1963d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 7 Jan 2016 21:25:07 -0800 Subject: [PATCH 161/311] minor change in how default attrs for autochangers work --- attributes/default.rb | 9 ++++----- metadata.rb | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index ba8ff3c..2c98cda 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -212,8 +212,7 @@ } # Developing Feature - Tape Autochanger Devices -default['bareos']['storage']['test_mode'] = false -if node.default['bareos']['storage']['test_mode'] = true +if node['bareos']['storage']['test_mode'] == true default['bareos']['storage']['autochangers']['autochanger-0'] = { 'Device' => [ 'tapedrive-0', @@ -222,7 +221,7 @@ 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] } - + default['bareos']['storage']['autochangers']['autochanger-1'] = { 'Device' => [ 'tapedrive-0' @@ -230,7 +229,7 @@ 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] } - + default['bareos']['storage']['devices']['tapedrive-0'] = { 'DeviceType' => 'tape', 'DriveIndex' => '0', @@ -240,7 +239,7 @@ 'AutomaticMount' => 'no', 'MaximumFileSize' => '10GB' } - + default['bareos']['storage']['devices']['tapedrive-1'] = { 'DeviceType' => 'tape', 'DriveIndex' => '0', diff --git a/metadata.rb b/metadata.rb index a4ce660..40d7d61 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.2' +version '2.1.3' %w( centos redhat ).each do |os| supports os, '>= 6.0' From f959b6eef9451e0b2a5691f5f827e8c0146742d8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:02:25 -0800 Subject: [PATCH 162/311] adding an unmanaged host to test against --- .kitchen.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index e3d232f..0c7db95 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -36,3 +36,12 @@ suites: storage: autochanger_enabled: true test_mode: true + server: + jobs: { + unmanaged-host-job: { + Description: '"Unmanaged Host Test Job"', + Client: 'unmanaged-client-fd', + JobDefs: 'default-def', + Type: 'Backup' + } + } From 2e69da6663ac1717e179ad97a5de8625eff5594a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:03:12 -0800 Subject: [PATCH 163/311] adding an unmanaged host to test against --- attributes/default.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index 2c98cda..eff914b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -249,4 +249,15 @@ 'AutomaticMount' => 'no', 'MaximumFileSize' => '10GB' } + +end + +# Unmanaged client for testing +if node['bareos']['storage']['test_mode'] == true + default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { + 'Address' => 'unmanaged-client', + 'Password' => 'onefbofnerwob', + 'Catalog' => 'MyCatalog', + 'FDPort' => '9102' + } end From e5e6b37b6d1d87ffa8c6151dd832c369f38c37f9 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:03:53 -0800 Subject: [PATCH 164/311] adding ability to add custom jobs and unmanaged hosts to appropriate templates --- recipes/server.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/server.rb b/recipes/server.rb index 688cdc9..eef367f 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -79,6 +79,7 @@ group 'bareos' mode '0640' variables( + clients: node['bareos']['clients']['unmanaged'], bareos_clients: bareos_clients, client_conf: node['bareos']['clients']['conf'] ) @@ -92,6 +93,7 @@ mode '0640' variables( bareos_clients: bareos_clients, + jobs: node['bareos']['server']['jobs'], client_jobs: node['bareos']['clients']['jobs'], client_restore_jobs: node['bareos']['clients']['restore_jobs'] ) From 0063de5f90dbcfbf451c571385a75a17f5c23784 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:04:47 -0800 Subject: [PATCH 165/311] adding section to template to add unmanaged clients if desired, shouldn't fail on nil --- templates/default/clients.conf.erb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index c7d320e..1d930e3 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -4,6 +4,17 @@ # # Bareos Client Configuration File +<% unless @clients.nil? %> + <% @clients.each do |client_key, client_value| %> +Client { + Name = "<%= client_key %>" + <% client_value.each do |key, value| %> + <%= key %> = <%= value %> + <% end %> +} + <% end %> +<% end %> + <% @bareos_clients.each do |client| %> Client { Name = <%= client['bareos']['clients']['name'] %>-fd From f78e751067855c13c57a2e368bffea549f852afb Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:05:15 -0800 Subject: [PATCH 166/311] adding section to template to add custom jobs if desired, shouldn't fail on nil --- templates/default/jobs.conf.erb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index dbb9ebc..e951aba 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -4,6 +4,17 @@ # # Bareos Jobs File +<% unless @jobs.nil? %> + <% @jobs.each do |job_key, job_value| %> +Job { + Name = "<%= job_key %>" + <% job_value.each do |key, value| %> + <%= key %> = <%= value %> + <% end %> +} + + <% end %> +<% end %> <% @bareos_clients.each do |client| %> Job { Name = "<%= client['bareos']['clients']['name'] %>-Job" From f3d67d81bca93182d8c4ba249827a5e77b5d837f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 9 Jan 2016 16:07:15 -0800 Subject: [PATCH 167/311] bump for custom jobs and unmanaged hosts feature --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 40d7d61..9983180 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.3' +version '2.1.4' %w( centos redhat ).each do |os| supports os, '>= 6.0' From fef3b9ffb07940532d837c28aed5b974de43e54b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 11 Jan 2016 13:57:43 -0800 Subject: [PATCH 168/311] typo correction --- attributes/default.rb | 4 +++- metadata.rb | 2 +- recipes/server.rb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index eff914b..5fe7faa 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -133,6 +133,8 @@ 'JobDefs' => 'default-restore-def' } +default['bareos']['server']['jobs'] = nil + # Job Definitions default['bareos']['clients']['job_definitions']['default-def'] = { 'Level' => 'Incremental', @@ -156,7 +158,7 @@ } # Filesets -default['baroes']['clients']['filesets']['default'] = { +default['bareos']['clients']['filesets']['default'] = { 'options' => { 'signature' => 'MD5' }, diff --git a/metadata.rb b/metadata.rb index 9983180..efb89f2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.4' +version '2.1.5' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index eef367f..db2659d 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -113,7 +113,7 @@ group 'bareos' mode '0640' variables( - fileset_config: node['baroes']['clients']['filesets'] + fileset_config: node['bareos']['clients']['filesets'] ) end template '/etc/bareos/bareos-dir.d/pools.conf' do From 07b17971632b650032793097ed4344a3c03e7dd5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 11 Jan 2016 13:59:43 -0800 Subject: [PATCH 169/311] bumping for typo fixes --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index efb89f2..b42f6e2 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.5' +version '2.1.6' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 0042184844fdd4022b9ca9ae0a79cb0b7b529c34 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:06:48 -0800 Subject: [PATCH 170/311] doing a slight restructuring of client jobs so more flexible --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 5fe7faa..734b8bf 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -125,11 +125,11 @@ } # Jobs -default['bareos']['clients']['jobs'] = { +default['bareos']['clients']['jobs'][node.default['bareos']['clients']['name']] = { 'JobDefs' => 'default-def' } -default['bareos']['clients']['restore_jobs'] = { +default['bareos']['clients']['restore_jobs'][node.default['bareos']['clients']['name']] = { 'JobDefs' => 'default-restore-def' } From 2b41a4b7627a2e4a4a94f12cb0eea12297193ae2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:07:18 -0800 Subject: [PATCH 171/311] formatting --- templates/default/clients.conf.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 1d930e3..3172172 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -12,9 +12,9 @@ Client { <%= key %> = <%= value %> <% end %> } + <% end %> <% end %> - <% @bareos_clients.each do |client| %> Client { Name = <%= client['bareos']['clients']['name'] %>-fd @@ -25,4 +25,5 @@ Client { <%= key %> = <%= value %> <% end %> } + <% end %> From 9d0282b2757fe99b2e16890ce1adfc21426b1d9b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:08:03 -0800 Subject: [PATCH 172/311] formatting, cleanup, restructure of client jobs for flexibility --- templates/default/job_definitions.conf.erb | 8 ++++--- templates/default/jobs.conf.erb | 27 ++++++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb index b2ae7ec..f2f9257 100644 --- a/templates/default/job_definitions.conf.erb +++ b/templates/default/job_definitions.conf.erb @@ -4,11 +4,13 @@ # # Bareos Job Definitions File -<% @job_definitions.each do |def_name, def_value| %> +<% unless @job_definitions.nil? %> + <% @job_definitions.each do |def_name, def_value| %> JobDefs { Name = "<%= def_name %>" - <% def_value.each do |key,value| %> + <% def_value.each do |key,value| %> <%= key %> = <%= value %> - <% end %> + <% end %> } + <% end %> <% end %> diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index e951aba..d7c8d29 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -15,23 +15,26 @@ Job { <% end %> <% end %> -<% @bareos_clients.each do |client| %> +<% @bareos_clients.each do |client_key, client_jobs| %> + <% @client_jobs.each do |key1,value1| %> Job { - Name = "<%= client['bareos']['clients']['name'] %>-Job" - Client = <%= client['bareos']['clients']['name'] %>-fd + Name = "<%= client_key['hostname'] %>-job" + Client = <%= client_key['hostname'] %>-fd Type = Backup - <% @client_jobs.each do |key1,value1| %> - <%= key1 %> = <%= value1 %> - <% end %> + <% value1.each do |k1, v1| %> + <%= k1 %> = <%= v1 %> + <% end %> } + <% end %> + <% @client_restore_jobs.each do |key2, value2| %> Job { - Name = "<%= client['bareos']['clients']['name'] %>-Restore-Job" - Client = <%= client['bareos']['clients']['name'] %>-fd + Name = "<%= client_key['hostname'] %>-restore-job" + Client = <%= client_key['hostname'] %>-fd Type = Restore - <% @client_restore_jobs.each do |key2,value2| %> - <%= key2 %> = <%= value2 %> - <% end %> + <% value2.each do |k2, v2| %> + <%= k2 %> = <%= v2 %> + <% end %> } - + <% end %> <% end %> From 0d94b8b06aac4828c62dfebb7b9eb34360e4fba5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:08:38 -0800 Subject: [PATCH 173/311] cleanup, formatting, adding some flexibility to client jobs --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index b42f6e2..4a16245 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.6' +version '2.1.7' %w( centos redhat ).each do |os| supports os, '>= 6.0' From e659c9837f20b6c48e852fce84076e9ceeefb170 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:26:12 -0800 Subject: [PATCH 174/311] adding in new attribute to split the client local name versus network name possible differences --- attributes/default.rb | 1 + metadata.rb | 2 +- templates/default/jobs.conf.erb | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 734b8bf..2adee18 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,6 +74,7 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] +default['bareos']['clients']['net_name'] = node['fqdn'] default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 default['bareos']['clients']['heartbeat_interval'] = 600 diff --git a/metadata.rb b/metadata.rb index 4a16245..408069e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.7' +version '2.1.8' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index d7c8d29..89cbde7 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -18,8 +18,8 @@ Job { <% @bareos_clients.each do |client_key, client_jobs| %> <% @client_jobs.each do |key1,value1| %> Job { - Name = "<%= client_key['hostname'] %>-job" - Client = <%= client_key['hostname'] %>-fd + Name = "<%= client_key['bareos']['clients']['name'] %>-job" + Client = <%= client_key['bareos']['clients']['net_name'] %>-fd Type = Backup <% value1.each do |k1, v1| %> <%= k1 %> = <%= v1 %> @@ -29,8 +29,8 @@ Job { <% end %> <% @client_restore_jobs.each do |key2, value2| %> Job { - Name = "<%= client_key['hostname'] %>-restore-job" - Client = <%= client_key['hostname'] %>-fd + Name = "<%= client_key['bareos']['clients']['name'] %>-restore-job" + Client = <%= client_key['bareos']['clients']['net_name'] %>-fd Type = Restore <% value2.each do |k2, v2| %> <%= k2 %> = <%= v2 %> From e4dc435a191a419df335ae507bb138ea10a85b12 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 12:56:55 -0800 Subject: [PATCH 175/311] working on a template bug, this may be fix --- metadata.rb | 2 +- templates/default/jobs.conf.erb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.rb b/metadata.rb index 408069e..4658f64 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.8' +version '2.1.9' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 89cbde7..657e032 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -15,11 +15,11 @@ Job { <% end %> <% end %> -<% @bareos_clients.each do |client_key, client_jobs| %> +<% @bareos_clients.each do |client| %> <% @client_jobs.each do |key1,value1| %> Job { - Name = "<%= client_key['bareos']['clients']['name'] %>-job" - Client = <%= client_key['bareos']['clients']['net_name'] %>-fd + Name = "<%= client['bareos']['clients']['name'] %>-job" + Client = <%= client['bareos']['clients']['net_name'] %>-fd Type = Backup <% value1.each do |k1, v1| %> <%= k1 %> = <%= v1 %> @@ -29,8 +29,8 @@ Job { <% end %> <% @client_restore_jobs.each do |key2, value2| %> Job { - Name = "<%= client_key['bareos']['clients']['name'] %>-restore-job" - Client = <%= client_key['bareos']['clients']['net_name'] %>-fd + Name = "<%= client['bareos']['clients']['name'] %>-restore-job" + Client = <%= client['bareos']['clients']['net_name'] %>-fd Type = Restore <% value2.each do |k2, v2| %> <%= k2 %> = <%= v2 %> From b61d41caa486835c538b0104c07c9f581214cbe8 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 13:25:09 -0800 Subject: [PATCH 176/311] editing attributes to handle test cases better --- .kitchen.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 0c7db95..9a246f8 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -28,14 +28,16 @@ suites: run_list: - role[bareos_director] attributes: + bareos: + test_mode: true - name: tape-storage run_list: - role[bareos_director] attributes: bareos: + test_mode: true storage: autochanger_enabled: true - test_mode: true server: jobs: { unmanaged-host-job: { From 88cd2579a98301f486fa4b4b3044a61892f11df2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 13:26:08 -0800 Subject: [PATCH 177/311] updating test logic wrapping so I can handle nil entries better --- attributes/default.rb | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 2adee18..61e25ff 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -94,7 +94,7 @@ default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 -# default['bareos']['storage']['autochanger_enabled'] = false # Experimental, Limited Support +default['bareos']['storage']['autochanger_enabled'] = false # Experimental, Limited Support # Director default['bareos']['director']['name'] = node['fqdn'] @@ -126,13 +126,17 @@ } # Jobs -default['bareos']['clients']['jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => 'default-def' -} - -default['bareos']['clients']['restore_jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => 'default-restore-def' -} +if node['bareos']['test_mode'] == true + default['bareos']['clients']['jobs'][node.default['bareos']['clients']['name']] = { + 'JobDefs' => 'default-def' + } + default['bareos']['clients']['restore_jobs'][node.default['bareos']['clients']['name']] = { + 'JobDefs' => 'default-restore-def' + } +else + default['bareos']['clients']['jobs'] = nil + default['bareos']['clients']['restore_jobs'] = nil +end default['bareos']['server']['jobs'] = nil @@ -215,7 +219,7 @@ } # Developing Feature - Tape Autochanger Devices -if node['bareos']['storage']['test_mode'] == true +if node['bareos']['test_mode'] == true && node['bareos']['storage']['autochanger_enabled'] == true default['bareos']['storage']['autochangers']['autochanger-0'] = { 'Device' => [ 'tapedrive-0', @@ -256,7 +260,7 @@ end # Unmanaged client for testing -if node['bareos']['storage']['test_mode'] == true +if node['bareos']['test_mode'] == true default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { 'Address' => 'unmanaged-client', 'Password' => 'onefbofnerwob', From 28ef16168d8bdf96544151dfe451cd18f9d0ed98 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 13:26:39 -0800 Subject: [PATCH 178/311] adding nil wrapper logic to template sections for jobs --- templates/default/jobs.conf.erb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 657e032..d016dcc 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -16,25 +16,29 @@ Job { <% end %> <% end %> <% @bareos_clients.each do |client| %> - <% @client_jobs.each do |key1,value1| %> + <% unless @client_jobs.nil? %> + <% @client_jobs.each do |key1,value1| %> Job { Name = "<%= client['bareos']['clients']['name'] %>-job" Client = <%= client['bareos']['clients']['net_name'] %>-fd Type = Backup - <% value1.each do |k1, v1| %> + <% value1.each do |k1, v1| %> <%= k1 %> = <%= v1 %> - <% end %> + <% end %> } + <% end %> <% end %> - <% @client_restore_jobs.each do |key2, value2| %> + <% unless @client_restore_jobs.nil? %> + <% @client_restore_jobs.each do |key2, value2| %> Job { Name = "<%= client['bareos']['clients']['name'] %>-restore-job" Client = <%= client['bareos']['clients']['net_name'] %>-fd Type = Restore - <% value2.each do |k2, v2| %> + <% value2.each do |k2, v2| %> <%= k2 %> = <%= v2 %> - <% end %> + <% end %> } + <% end %> <% end %> <% end %> From 6c1597d4afbbad0b4a1884cb375fde8210194dec Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 13:27:20 -0800 Subject: [PATCH 179/311] updating nil wrapper logic and test attribute logic --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 4658f64..d46c2f8 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.9' +version '2.1.10' %w( centos redhat ).each do |os| supports os, '>= 6.0' From a5b150d6ad60a2c4286a0649f5d0693442b14c83 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 15:12:36 -0800 Subject: [PATCH 180/311] pushing a fix to my template --- metadata.rb | 2 +- templates/default/jobs.conf.erb | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/metadata.rb b/metadata.rb index d46c2f8..a933992 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.10' +version '2.1.11' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index d016dcc..8c56802 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -15,30 +15,28 @@ Job { <% end %> <% end %> -<% @bareos_clients.each do |client| %> - <% unless @client_jobs.nil? %> - <% @client_jobs.each do |key1,value1| %> +<% unless @client_jobs.nil? %> + <% @client_jobs.each do |key1,value1| %> Job { - Name = "<%= client['bareos']['clients']['name'] %>-job" - Client = <%= client['bareos']['clients']['net_name'] %>-fd + Name = "<%= key1 %>-job" + Client = <%= key1 %>-fd Type = Backup - <% value1.each do |k1, v1| %> + <% value1.each do |k1, v1| %> <%= k1 %> = <%= v1 %> - <% end %> + <% end %> } - <% end %> <% end %> - <% unless @client_restore_jobs.nil? %> - <% @client_restore_jobs.each do |key2, value2| %> +<% end %> +<% unless @client_restore_jobs.nil? %> + <% @client_restore_jobs.each do |key2, value2| %> Job { - Name = "<%= client['bareos']['clients']['name'] %>-restore-job" - Client = <%= client['bareos']['clients']['net_name'] %>-fd + Name = "<%= key2 %>-restore-job" + Client = <%= key2 %>-fd Type = Restore - <% value2.each do |k2, v2| %> + <% value2.each do |k2, v2| %> <%= k2 %> = <%= v2 %> - <% end %> -} <% end %> +} <% end %> <% end %> From 4c94ebd73cfee040c415ae0b710a4a14e7e58b1c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 16:30:58 -0800 Subject: [PATCH 181/311] bumping for job template and attribute fixes, and client template typo --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index a933992..8bafd4f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.11' +version '2.1.12' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 159b39c84b630dde3ad4affc0ed681e21a859992 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 16:31:53 -0800 Subject: [PATCH 182/311] just they way it worked out, needed to form things in this manner --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 61e25ff..2bd3676 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -128,10 +128,10 @@ # Jobs if node['bareos']['test_mode'] == true default['bareos']['clients']['jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => 'default-def' + 'JobDefs' => ['default-def'] } default['bareos']['clients']['restore_jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => 'default-restore-def' + 'JobDefs' => ['default-restore-def'] } else default['bareos']['clients']['jobs'] = nil From 10e89942d457870d6f2a635a4b85bd3853bcbf08 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 16:33:15 -0800 Subject: [PATCH 183/311] found typo, missing quotes --- templates/default/clients.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 3172172..ded57d5 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -17,7 +17,7 @@ Client { <% end %> <% @bareos_clients.each do |client| %> Client { - Name = <%= client['bareos']['clients']['name'] %>-fd + Name = "<%= client['bareos']['clients']['name'] %>-fd" Address = <%= client['bareos']['clients']['name'] %> Password = "<%= client['bareos']['fd_password'] %>" # password for FileDaemon Catalog = <%= client['bareos']['database']['catalog_name'] %> From f488ef88489be4355a328c6c32bc6da59c928331 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 16:33:39 -0800 Subject: [PATCH 184/311] had to add an additional layer to format things correctly --- templates/default/jobs.conf.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 8c56802..f6d6df0 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -22,7 +22,9 @@ Job { Client = <%= key1 %>-fd Type = Backup <% value1.each do |k1, v1| %> - <%= k1 %> = <%= v1 %> + <% v1.each do |v1a| %> + <%= k1 %> = <%= v1a %> + <% end %> <% end %> } @@ -35,7 +37,9 @@ Job { Client = <%= key2 %>-fd Type = Restore <% value2.each do |k2, v2| %> - <%= k2 %> = <%= v2 %> + <% v2.each do |v2a| %> + <%= k2 %> = <%= v2a %> + <% end %> <% end %> } <% end %> From 16b60e10f31f649167f0546402f6b61d2d284f06 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 20:16:29 -0800 Subject: [PATCH 185/311] removing attribute, didn't need it afterall, adding newline to jobs template --- attributes/default.rb | 1 - templates/default/jobs.conf.erb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 2bd3676..23e07bf 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,7 +74,6 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] -default['bareos']['clients']['net_name'] = node['fqdn'] default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 default['bareos']['clients']['heartbeat_interval'] = 600 diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index f6d6df0..dd395c7 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -42,5 +42,6 @@ Job { <% end %> <% end %> } + <% end %> <% end %> From e7f713e8d0861cf7289486601869ab58083b91f4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 20:37:38 -0800 Subject: [PATCH 186/311] adding a space between config sections --- templates/default/bconsole.conf.erb | 1 + templates/default/filesets.conf.erb | 1 + templates/default/job_definitions.conf.erb | 1 + templates/default/pools.conf.erb | 1 + templates/default/schedules.conf.erb | 1 + templates/default/storages.conf.erb | 1 + 6 files changed, 6 insertions(+) diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index 128a925..48097fc 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -11,4 +11,5 @@ Director { DIRport = <%= director['bareos']['director']['dir_port'] %> Password = "<%= director['bareos']['dir_password'] %>" } + <% end %> diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index d77ed2b..d5d0bb6 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -27,4 +27,5 @@ FileSet { <% end %> } } + <% end %> diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb index f2f9257..7f17fb0 100644 --- a/templates/default/job_definitions.conf.erb +++ b/templates/default/job_definitions.conf.erb @@ -12,5 +12,6 @@ JobDefs { <%= key %> = <%= value %> <% end %> } + <% end %> <% end %> diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb index 52c142a..91eaba9 100644 --- a/templates/default/pools.conf.erb +++ b/templates/default/pools.conf.erb @@ -11,4 +11,5 @@ Pool { <%= key %> = <%= value %> <% end %> } + <% end %> diff --git a/templates/default/schedules.conf.erb b/templates/default/schedules.conf.erb index bd38e6a..358fe06 100644 --- a/templates/default/schedules.conf.erb +++ b/templates/default/schedules.conf.erb @@ -17,4 +17,5 @@ Schedule { Enabled = <%= enabled %> <% end %> } + <% end %> diff --git a/templates/default/storages.conf.erb b/templates/default/storages.conf.erb index a577f7a..0ce9bd5 100644 --- a/templates/default/storages.conf.erb +++ b/templates/default/storages.conf.erb @@ -12,4 +12,5 @@ Storage { <%= key %> = <%= value %> <% end %> } + <% end %> From a955e683eb5e111727df4277317f76dba32a08d7 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 21:30:36 -0800 Subject: [PATCH 187/311] missed more quotes --- templates/default/pools.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb index 91eaba9..99d6a7f 100644 --- a/templates/default/pools.conf.erb +++ b/templates/default/pools.conf.erb @@ -6,7 +6,7 @@ <% @client_pools.each do |pool_name, pool| %> Pool { - Name = <%= pool_name %> + Name = "<%= pool_name %>" <% pool.each do |key,value| %> <%= key %> = <%= value %> <% end %> From d201e0cbea5811508ad492e22bc09e9a4483049c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 21:31:12 -0800 Subject: [PATCH 188/311] bump for cleanup --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 8bafd4f..1e9f73e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.12' +version '2.1.13' %w( centos redhat ).each do |os| supports os, '>= 6.0' From cc69d71cac37d4646488b12336305c4476bed5a7 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 12 Jan 2016 23:10:41 -0800 Subject: [PATCH 189/311] trying something closer to original method --- attributes/default.rb | 18 +++++++----------- metadata.rb | 2 +- templates/default/jobs.conf.erb | 32 +++++++++++--------------------- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 23e07bf..d0797d7 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -125,17 +125,13 @@ } # Jobs -if node['bareos']['test_mode'] == true - default['bareos']['clients']['jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => ['default-def'] - } - default['bareos']['clients']['restore_jobs'][node.default['bareos']['clients']['name']] = { - 'JobDefs' => ['default-restore-def'] - } -else - default['bareos']['clients']['jobs'] = nil - default['bareos']['clients']['restore_jobs'] = nil -end +default['bareos']['clients']['jobs'] = { + 'JobDefs' => 'default-def' +} + +default['bareos']['clients']['restore_jobs'] = { + 'JobDefs' => 'default-restore-def' +} default['bareos']['server']['jobs'] = nil diff --git a/metadata.rb b/metadata.rb index 1e9f73e..84a807b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.13' +version '2.1.14' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index dd395c7..12ce303 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -15,33 +15,23 @@ Job { <% end %> <% end %> -<% unless @client_jobs.nil? %> - <% @client_jobs.each do |key1,value1| %> +<% @bareos_clients.each do |client| %> Job { - Name = "<%= key1 %>-job" - Client = <%= key1 %>-fd + Name = "<%= client['bareos']['clients']['name'] %>-job" + Client = <%= client['bareos']['clients']['name'] %>-fd Type = Backup - <% value1.each do |k1, v1| %> - <% v1.each do |v1a| %> - <%= k1 %> = <%= v1a %> - <% end %> - <% end %> + <% @client_jobs.each do |key1,value1| %> + <%= key1 %> = <%= value1 %> + <% end %> } - <% end %> -<% end %> -<% unless @client_restore_jobs.nil? %> - <% @client_restore_jobs.each do |key2, value2| %> Job { - Name = "<%= key2 %>-restore-job" - Client = <%= key2 %>-fd + Name = "<%= client['bareos']['clients']['name'] %>-restore-job" + Client = <%= client['bareos']['clients']['name'] %>-fd Type = Restore - <% value2.each do |k2, v2| %> - <% v2.each do |v2a| %> - <%= k2 %> = <%= v2a %> - <% end %> - <% end %> + <% @client_restore_jobs.each do |key2, value2| %> + <%= key2 %> = <%= value2 %> + <% end %> } - <% end %> <% end %> From 3691760907f3e6fb05110e09eb36c43e548cca37 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 00:20:27 -0800 Subject: [PATCH 190/311] trying to simplify the jobs feature --- attributes/default.rb | 8 ++++++-- recipes/server.rb | 5 +---- templates/default/jobs.conf.erb | 20 -------------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index d0797d7..3f92e05 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -125,11 +125,15 @@ } # Jobs -default['bareos']['clients']['jobs'] = { +default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Backup', 'JobDefs' => 'default-def' } -default['bareos']['clients']['restore_jobs'] = { +default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Restore', 'JobDefs' => 'default-restore-def' } diff --git a/recipes/server.rb b/recipes/server.rb index db2659d..35ec206 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -92,10 +92,7 @@ group 'bareos' mode '0640' variables( - bareos_clients: bareos_clients, - jobs: node['bareos']['server']['jobs'], - client_jobs: node['bareos']['clients']['jobs'], - client_restore_jobs: node['bareos']['clients']['restore_jobs'] + jobs: node['bareos']['clients']['jobs'] ) end template '/etc/bareos/bareos-dir.d/job_definitions.conf' do diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index 12ce303..a15d059 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -15,23 +15,3 @@ Job { <% end %> <% end %> -<% @bareos_clients.each do |client| %> -Job { - Name = "<%= client['bareos']['clients']['name'] %>-job" - Client = <%= client['bareos']['clients']['name'] %>-fd - Type = Backup - <% @client_jobs.each do |key1,value1| %> - <%= key1 %> = <%= value1 %> - <% end %> -} - -Job { - Name = "<%= client['bareos']['clients']['name'] %>-restore-job" - Client = <%= client['bareos']['clients']['name'] %>-fd - Type = Restore - <% @client_restore_jobs.each do |key2, value2| %> - <%= key2 %> = <%= value2 %> - <% end %> -} - -<% end %> From ce3c5082bb326907fb186105b469f7b5d5f68221 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 00:20:37 -0800 Subject: [PATCH 191/311] trying to simplify the jobs feature --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 84a807b..b56326f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.14' +version '2.1.15' %w( centos redhat ).each do |os| supports os, '>= 6.0' From e6af9151b91d7016737e62ed8b3c3e7f885c91e2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 01:12:45 -0800 Subject: [PATCH 192/311] Adding back the alternate client name for differnet network name cases --- attributes/default.rb | 1 + metadata.rb | 2 +- templates/default/clients.conf.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 3f92e05..4b17809 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -74,6 +74,7 @@ # Clients default['bareos']['clients']['name'] = node['fqdn'] +default['bareos']['clients']['net_name'] = node['fqdn'] default['bareos']['clients']['fd_port'] = 9102 default['bareos']['clients']['max_concurrent_jobs'] = 20 default['bareos']['clients']['heartbeat_interval'] = 600 diff --git a/metadata.rb b/metadata.rb index b56326f..d32e4ed 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.15' +version '2.1.16' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index ded57d5..73e5ff4 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -18,7 +18,7 @@ Client { <% @bareos_clients.each do |client| %> Client { Name = "<%= client['bareos']['clients']['name'] %>-fd" - Address = <%= client['bareos']['clients']['name'] %> + Address = <%= client['bareos']['clients']['net_name'] %> Password = "<%= client['bareos']['fd_password'] %>" # password for FileDaemon Catalog = <%= client['bareos']['database']['catalog_name'] %> <% @client_conf.each do |key, value| %> From e3a815f4c79d5b52feb4ec83b5ee628cdc8be380 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 01:35:31 -0800 Subject: [PATCH 193/311] This was messing with wrappers --- attributes/default.rb | 24 ++++++++++++------------ metadata.rb | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 4b17809..91ca555 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -125,18 +125,18 @@ 'Maximum Concurrent Jobs' => '20' } -# Jobs -default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { - 'Client' => "#{node['bareos']['clients']['name']}-fd", - 'Type' => 'Backup', - 'JobDefs' => 'default-def' -} - -default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { - 'Client' => "#{node['bareos']['clients']['name']}-fd", - 'Type' => 'Restore', - 'JobDefs' => 'default-restore-def' -} +# Jobs - Example +# default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { +# 'Client' => "#{node['bareos']['clients']['name']}-fd", +# 'Type' => 'Backup', +# 'JobDefs' => 'default-def' +# } +# +# default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { +# 'Client' => "#{node['bareos']['clients']['name']}-fd", +# 'Type' => 'Restore', +# 'JobDefs' => 'default-restore-def' +# } default['bareos']['server']['jobs'] = nil diff --git a/metadata.rb b/metadata.rb index d32e4ed..c0400fe 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.16' +version '2.1.17' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 81f058a484c0d3b02e538a23855f9c6cdcda312f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 02:08:43 -0800 Subject: [PATCH 194/311] minor adjustment to test cases --- attributes/default.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 91ca555..c8443aa 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -257,10 +257,7 @@ 'MaximumFileSize' => '10GB' } -end - # Unmanaged client for testing -if node['bareos']['test_mode'] == true default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { 'Address' => 'unmanaged-client', 'Password' => 'onefbofnerwob', From 6e384138b05fbd2f595b7ad980646e12e5d96eec Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 02:08:57 -0800 Subject: [PATCH 195/311] minor adjustment to test cases --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c0400fe..107f3a5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.17' +version '2.1.18' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 512126cedc199b1d6bd43acf10bd0520e52bff19 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 13 Jan 2016 03:38:33 -0800 Subject: [PATCH 196/311] adding another net_name attribute for custom setups --- attributes/default.rb | 1 + metadata.rb | 2 +- templates/default/bconsole.conf.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index c8443aa..e1e386c 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -98,6 +98,7 @@ # Director default['bareos']['director']['name'] = node['fqdn'] +default['bareos']['director']['net_name'] = node['fqdn'] default['bareos']['director']['dir_search_query'] = 'roles:bareos_director' default['bareos']['director']['dir_port'] = 9101 default['bareos']['director']['dir_max_concurrent_jobs'] = 20 diff --git a/metadata.rb b/metadata.rb index 107f3a5..d1a42c5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.18' +version '2.1.19' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index 48097fc..6a67deb 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -7,7 +7,7 @@ <% @bareos_dir.each do |director| %> Director { Name = <%= director['bareos']['director']['name'] %>-dir - address = <%= director['bareos']['director']['name'] %> + address = <%= director['bareos']['director']['net_name'] %> DIRport = <%= director['bareos']['director']['dir_port'] %> Password = "<%= director['bareos']['dir_password'] %>" } From d9e9d5140f41e7becaa63775e6c54c84c1ad359b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 14 Jan 2016 10:55:45 -0800 Subject: [PATCH 197/311] migrating dir_helper.conf to template so i can add inclusions for wrappers if desired, like other conf files --- .kitchen.yml | 7 +++++++ attributes/default.rb | 4 ++-- recipes/server.rb | 7 +++++-- templates/default/dir_helper.conf.erb | 11 +++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 templates/default/dir_helper.conf.erb diff --git a/.kitchen.yml b/.kitchen.yml index 9a246f8..71f43be 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -24,12 +24,19 @@ platforms: roles_path: test/integration/roles/ suites: + - name: aio-server run_list: - role[bareos_director] attributes: bareos: test_mode: true + server: + conf: + help: { + test: '# Some String' + } + - name: tape-storage run_list: - role[bareos_director] diff --git a/attributes/default.rb b/attributes/default.rb index e1e386c..142c38b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -132,7 +132,7 @@ # 'Type' => 'Backup', # 'JobDefs' => 'default-def' # } -# +# # default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { # 'Client' => "#{node['bareos']['clients']['name']}-fd", # 'Type' => 'Restore', @@ -258,7 +258,7 @@ 'MaximumFileSize' => '10GB' } -# Unmanaged client for testing + # Unmanaged client for testing default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { 'Address' => 'unmanaged-client', 'Password' => 'onefbofnerwob', diff --git a/recipes/server.rb b/recipes/server.rb index 35ec206..c762c7a 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -40,11 +40,14 @@ action :create end -file '/etc/bareos/bareos-dir.d/dir_helper.conf' do - content '# This is a base file so the recipe works with no additional help' +template '/etc/bareos/bareos-dir.d/dir_helper.conf' do + source 'dir_helper.conf.erb' owner 'root' group 'root' mode '0644' + variables( + dir_help: node['bareos']['server']['conf']['help'] + ) action :create end diff --git a/templates/default/dir_helper.conf.erb b/templates/default/dir_helper.conf.erb new file mode 100644 index 0000000..2d22ab4 --- /dev/null +++ b/templates/default/dir_helper.conf.erb @@ -0,0 +1,11 @@ +# This is a base file so the recipe works with no additional help. +# You can also include a list of strings to assist with additonal config +# inclusions or other bits not currently available in the base director template + +<% unless @dir_help.nil? %> + <% @dir_help.each do |helper_name, helper_str| %> +# <%= helper_name %> +<%= helper_str %> + + <% end %> +<% end %> From 0d270a9ddbdb802cef42f7fb595ff55cfff3d442 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 14 Jan 2016 10:56:13 -0800 Subject: [PATCH 198/311] bump for dir_helper template conversion --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index d1a42c5..5f98c62 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.19' +version '2.1.20' %w( centos redhat ).each do |os| supports os, '>= 6.0' From bd273fc7232bf6a5a38ae44d9cb3079ee0459928 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 15 Jan 2016 21:33:19 -0800 Subject: [PATCH 199/311] i think this may be a minor bug, testing --- metadata.rb | 2 +- templates/default/bareos-dir.conf.erb | 2 +- templates/default/device-tape-with-autoloader.conf.erb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index 5f98c62..64c2d66 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.20' +version '2.1.21' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index a6dd936..02b0ffb 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -27,7 +27,7 @@ Job { Name = "<%= @dir_name %>-BackupCatalog" Type = Backup Client = <%= @dir_name %>-fd - JobDefs = "default-def" + JobDefs = <%= node['bareos']['director']['catalog_jobdef'] %>" Level = Full FileSet = "Catalog" Schedule = "WeeklyCycleAfterBackup" diff --git a/templates/default/device-tape-with-autoloader.conf.erb b/templates/default/device-tape-with-autoloader.conf.erb index 3546f74..e1ef6a7 100644 --- a/templates/default/device-tape-with-autoloader.conf.erb +++ b/templates/default/device-tape-with-autoloader.conf.erb @@ -39,7 +39,7 @@ <%# AutoChanger Config %> <% @autochangers.each do |autochanger_key, line_value1| %> Autochanger { - Name = "<%= autochanger_key %>" + Name = <%= autochanger_key %> Description = "<%= autochanger_key %> Defined by Chef" <% line_value1.each do |key1, value1| %> <% value1.each do |v1| %> @@ -52,7 +52,7 @@ Autochanger { <%# Device Config %> <% @devices.each do |device_key, line_value2| %> Device { - Name = "<%= device_key %>" + Name = <%= device_key %> Description = "<%= device_key %> Defined by Chef" <% line_value2.each do |key2, value2| %> <%= key2 %> = <%= value2 %> From 12adb3ddf7c654f80debab932d13b68a63a2d09c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 15 Jan 2016 21:37:15 -0800 Subject: [PATCH 200/311] missed this from last addition, missing quote --- metadata.rb | 2 +- templates/default/bareos-dir.conf.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 64c2d66..3129315 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.21' +version '2.1.22' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/templates/default/bareos-dir.conf.erb b/templates/default/bareos-dir.conf.erb index 02b0ffb..7c6adc3 100644 --- a/templates/default/bareos-dir.conf.erb +++ b/templates/default/bareos-dir.conf.erb @@ -27,7 +27,7 @@ Job { Name = "<%= @dir_name %>-BackupCatalog" Type = Backup Client = <%= @dir_name %>-fd - JobDefs = <%= node['bareos']['director']['catalog_jobdef'] %>" + JobDefs = "<%= node['bareos']['director']['catalog_jobdef'] %>" Level = Full FileSet = "Catalog" Schedule = "WeeklyCycleAfterBackup" From f4cc580b1783270499c41ac551820a391a48c301 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Fri, 15 Jan 2016 22:22:35 -0800 Subject: [PATCH 201/311] adding default def special for the catalog, can change in wrapper if desired --- attributes/default.rb | 11 +++++++++++ metadata.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 142c38b..37ff603 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -105,6 +105,7 @@ default['bareos']['director']['servers'] = %w(node) default['bareos']['director']['console_commandacl'] = 'status, .status' default['bareos']['director']['heartbeat_interval'] = 600 +default['bareos']['director']['catalog_jobdef'] = 'default-catalog-def' # Subscription Management (Director) default['bareos']['director']['dir_subscription'] = nil @@ -154,6 +155,16 @@ 'SpoolData' => 'no' } +default['bareos']['clients']['job_definitions']['default-catalog-def'] = { + 'Level' => 'Full', + 'Fileset' => 'Catalog', + 'Schedule' => 'WeeklyCycleAfterBackup', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Allow Duplicate Jobs' => 'no' +} + default['bareos']['clients']['job_definitions']['default-restore-def'] = { 'Fileset' => 'default-fileset', 'Storage' => 'default-file-storage', diff --git a/metadata.rb b/metadata.rb index 3129315..c5e3752 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.22' +version '2.1.23' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 90eab3b13fe75eb9584847525727e915d2e72640 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sat, 16 Jan 2016 15:05:35 -0800 Subject: [PATCH 202/311] fixing some permissions that seem to cause issues --- metadata.rb | 2 +- recipes/server.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata.rb b/metadata.rb index c5e3752..1336b0a 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.23' +version '2.1.24' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index c762c7a..12577c4 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -42,8 +42,8 @@ template '/etc/bareos/bareos-dir.d/dir_helper.conf' do source 'dir_helper.conf.erb' - owner 'root' - group 'root' + owner 'bareos' + group 'bareos' mode '0644' variables( dir_help: node['bareos']['server']['conf']['help'] From 9e19152dcfe201c0d13d6947d49c7b63837bd794 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 19 Jan 2016 19:16:25 -0800 Subject: [PATCH 203/311] Removing the postgresql cookbook constraint of '< 4.0.0' --- metadata.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 1336b0a..f52c680 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.24' +version '2.2.1' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -16,5 +16,5 @@ depends 'apt' depends 'openssl' -depends 'postgresql', '< 4.0.0' +depends 'postgresql' depends 'yum' From 95d1ad3a1eea0c55fb525090441ac228f5bbe7da Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 19 Jan 2016 22:24:35 -0800 Subject: [PATCH 204/311] adding the postgresql cookbook limitation until some things are cleaned up post 4.0 version --- metadata.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index f52c680..f6a81a4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.1' +version '2.2.2' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -16,5 +16,5 @@ depends 'apt' depends 'openssl' -depends 'postgresql' +depends 'postgresql', '< 4.0.0' depends 'yum' From 19335c92c8480ab4a44003f58edd2d68bd099b95 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 20 Jan 2016 11:30:09 -0800 Subject: [PATCH 205/311] adding a sort to the results of the bareos_clients search, fixing attribute naming schema for helper --- attributes/default.rb | 1 + recipes/server.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 37ff603..20387d4 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -106,6 +106,7 @@ default['bareos']['director']['console_commandacl'] = 'status, .status' default['bareos']['director']['heartbeat_interval'] = 600 default['bareos']['director']['catalog_jobdef'] = 'default-catalog-def' +default['bareos']['director']['conf']['help']['Example Block'] = '# Put any extra configs you would like to include in the director config below this line. Chef manages this file so make sure you are using the attributes to apply them.' # Subscription Management (Director) default['bareos']['director']['dir_subscription'] = nil diff --git a/recipes/server.rb b/recipes/server.rb index 12577c4..7bc6f93 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -46,7 +46,7 @@ group 'bareos' mode '0644' variables( - dir_help: node['bareos']['server']['conf']['help'] + dir_help: node['bareos']['director']['conf']['help'] ) action :create end @@ -83,7 +83,7 @@ mode '0640' variables( clients: node['bareos']['clients']['unmanaged'], - bareos_clients: bareos_clients, + bareos_clients: bareos_clients.sort, client_conf: node['bareos']['clients']['conf'] ) end From 8073ba5b4ee08df3375413e8b196800f5d09da60 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 20 Jan 2016 11:44:46 -0800 Subject: [PATCH 206/311] adding same functionality for the sd as I did with the server/director --- recipes/storage.rb | 7 +++++-- templates/default/sd_helper.conf.erb | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 templates/default/sd_helper.conf.erb diff --git a/recipes/storage.rb b/recipes/storage.rb index 4276b8d..74246b2 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -47,11 +47,14 @@ action :create end -file '/etc/bareos/bareos-sd.d/sd_helper.conf' do - content '# This is a base file so the recipe works with no additional help' +template '/etc/bareos/bareos-sd.d/sd_helper.conf' do + source 'sd_helper.conf.erb' owner 'root' group 'bareos' mode '0644' + variables( + sd_help: node['bareos']['storage']['conf']['help'] + ) action :create end diff --git a/templates/default/sd_helper.conf.erb b/templates/default/sd_helper.conf.erb new file mode 100644 index 0000000..edece72 --- /dev/null +++ b/templates/default/sd_helper.conf.erb @@ -0,0 +1,17 @@ +<%# STORAGE DAEMON HELPER TEMPLATE %> +# Generated by Chef for <%= node['bareos']['storage']['name'] %> +# Local modifications will be overwritten. +# +# Bareos Storage Daemon Helper Configuration File + +# This is a base file so the recipe works with no additional help. +# You can also include a list of strings to assist with additonal config +# inclusions or other bits not currently available in the base storage daemon template + +<% unless @sd_help.nil? %> + <% @sd_help.each do |helper_name, helper_str| %> +# <%= helper_name %> +<%= helper_str %> + + <% end %> +<% end %> From 7d802b432875143ff9a42b3f2cc017a1bd78bbb2 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 20 Jan 2016 11:45:13 -0800 Subject: [PATCH 207/311] adding basic example attribute for the sd_helpoer bits --- attributes/default.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 20387d4..0ce9efe 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -94,7 +94,8 @@ default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 -default['bareos']['storage']['autochanger_enabled'] = false # Experimental, Limited Support +default['bareos']['storage']['autochanger_enabled'] = false +default['bareos']['storage']['conf']['help']['Example Block'] = '# Put any extra configs you would like to include in the storage daemon config below this line. Chef manages this file so make sure you are using the attributes to apply them.' # Director default['bareos']['director']['name'] = node['fqdn'] From e0e7127564379abdb34adf9a80a0681d63a96b7b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 20 Jan 2016 11:46:02 -0800 Subject: [PATCH 208/311] adding better headers to my templates and had an extra # in there for some reason --- templates/default/bareos-sd.conf.erb | 2 +- templates/default/dir_helper.conf.erb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/default/bareos-sd.conf.erb b/templates/default/bareos-sd.conf.erb index 14cdc5a..8c78955 100644 --- a/templates/default/bareos-sd.conf.erb +++ b/templates/default/bareos-sd.conf.erb @@ -2,7 +2,7 @@ # Generated by Chef for <%= node['bareos']['storage']['name'] %> # Local modifications will be overwritten. # -# Bareos Storage Daemon Configuration File# +# Bareos Storage Daemon Configuration File Storage { Name = <%= node['bareos']['storage']['name'] %>-sd diff --git a/templates/default/dir_helper.conf.erb b/templates/default/dir_helper.conf.erb index 2d22ab4..864e054 100644 --- a/templates/default/dir_helper.conf.erb +++ b/templates/default/dir_helper.conf.erb @@ -1,3 +1,9 @@ +<%# DIRECTOR HELPER TEMPLATE %> +# Generated by Chef for <%= node['bareos']['storage']['name'] %> +# Local modifications will be overwritten. +# +# Bareos Director Helper Configuration File + # This is a base file so the recipe works with no additional help. # You can also include a list of strings to assist with additonal config # inclusions or other bits not currently available in the base director template From 285b6a2701764a24d0326b0dd26d82dc26aeab46 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 20 Jan 2016 11:47:02 -0800 Subject: [PATCH 209/311] bump for adding sd_helper template bits and better headers and schema improvement for dir_helper --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index f6a81a4..ba0fd93 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.2' +version '2.2.3' %w( centos redhat ).each do |os| supports os, '>= 6.0' From ac3a09ec1c0496f1914541100d44635f5fcab1f1 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Tue, 26 Jan 2016 15:49:47 -0800 Subject: [PATCH 210/311] attempting to fix a sorting issue that leads to a restart of the director, killing jobs --- metadata.rb | 2 +- recipes/server.rb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/metadata.rb b/metadata.rb index ba0fd93..c4c1e28 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.3' +version '2.2.4' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index 7bc6f93..156772e 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -82,9 +82,9 @@ group 'bareos' mode '0640' variables( - clients: node['bareos']['clients']['unmanaged'], + clients: node['bareos']['clients']['unmanaged'].sort, bareos_clients: bareos_clients.sort, - client_conf: node['bareos']['clients']['conf'] + client_conf: node['bareos']['clients']['conf'].sort ) end @@ -95,7 +95,7 @@ group 'bareos' mode '0640' variables( - jobs: node['bareos']['clients']['jobs'] + jobs: node['bareos']['clients']['jobs'].sort ) end template '/etc/bareos/bareos-dir.d/job_definitions.conf' do @@ -104,7 +104,7 @@ group 'bareos' mode '0640' variables( - job_definitions: node['bareos']['clients']['job_definitions'] + job_definitions: node['bareos']['clients']['job_definitions'].sort ) end template '/etc/bareos/bareos-dir.d/filesets.conf' do @@ -113,7 +113,7 @@ group 'bareos' mode '0640' variables( - fileset_config: node['bareos']['clients']['filesets'] + fileset_config: node['bareos']['clients']['filesets'].sort ) end template '/etc/bareos/bareos-dir.d/pools.conf' do @@ -122,7 +122,7 @@ group 'bareos' mode '0640' variables( - client_pools: node['bareos']['clients']['pools'] + client_pools: node['bareos']['clients']['pools'].sort ) end template '/etc/bareos/bareos-dir.d/schedules.conf' do @@ -131,7 +131,7 @@ group 'bareos' mode '0640' variables( - client_schedules: node['bareos']['clients']['schedules'] + client_schedules: node['bareos']['clients']['schedules'].sort ) end template '/etc/bareos/bareos-dir.d/storages.conf' do @@ -140,7 +140,7 @@ group 'bareos' mode '0640' variables( - client_storages: node['bareos']['clients']['storages'] + client_storages: node['bareos']['clients']['storages'].sort ) end From 31b58adf2827d79fdc750082c5caf26f47640546 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 00:37:22 -0800 Subject: [PATCH 211/311] decided to sort on the template side, seems easier that way, kitchen good, more live tests needed --- metadata.rb | 2 +- recipes/server.rb | 18 +++++++++--------- templates/default/bconsole.conf.erb | 2 +- templates/default/clients.conf.erb | 4 ++-- .../device-tape-with-autoloader.conf.erb | 4 ++-- templates/default/dir_helper.conf.erb | 2 +- templates/default/filesets.conf.erb | 2 +- templates/default/job_definitions.conf.erb | 2 +- templates/default/jobs.conf.erb | 2 +- templates/default/pools.conf.erb | 2 +- templates/default/schedules.conf.erb | 2 +- templates/default/sd_helper.conf.erb | 2 +- templates/default/storages.conf.erb | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) diff --git a/metadata.rb b/metadata.rb index c4c1e28..b35ac04 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.4' +version '2.2.5' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index 156772e..f3edcef 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -82,9 +82,9 @@ group 'bareos' mode '0640' variables( - clients: node['bareos']['clients']['unmanaged'].sort, - bareos_clients: bareos_clients.sort, - client_conf: node['bareos']['clients']['conf'].sort + unmanaged_clients: node['bareos']['clients']['unmanaged'], + bareos_clients: bareos_clients, + client_conf: node['bareos']['clients']['conf'] ) end @@ -95,7 +95,7 @@ group 'bareos' mode '0640' variables( - jobs: node['bareos']['clients']['jobs'].sort + jobs: node['bareos']['clients']['jobs'] ) end template '/etc/bareos/bareos-dir.d/job_definitions.conf' do @@ -104,7 +104,7 @@ group 'bareos' mode '0640' variables( - job_definitions: node['bareos']['clients']['job_definitions'].sort + job_definitions: node['bareos']['clients']['job_definitions'] ) end template '/etc/bareos/bareos-dir.d/filesets.conf' do @@ -113,7 +113,7 @@ group 'bareos' mode '0640' variables( - fileset_config: node['bareos']['clients']['filesets'].sort + fileset_config: node['bareos']['clients']['filesets'] ) end template '/etc/bareos/bareos-dir.d/pools.conf' do @@ -122,7 +122,7 @@ group 'bareos' mode '0640' variables( - client_pools: node['bareos']['clients']['pools'].sort + client_pools: node['bareos']['clients']['pools'] ) end template '/etc/bareos/bareos-dir.d/schedules.conf' do @@ -131,7 +131,7 @@ group 'bareos' mode '0640' variables( - client_schedules: node['bareos']['clients']['schedules'].sort + client_schedules: node['bareos']['clients']['schedules'] ) end template '/etc/bareos/bareos-dir.d/storages.conf' do @@ -140,7 +140,7 @@ group 'bareos' mode '0640' variables( - client_storages: node['bareos']['clients']['storages'].sort + client_storages: node['bareos']['clients']['storages'] ) end diff --git a/templates/default/bconsole.conf.erb b/templates/default/bconsole.conf.erb index 6a67deb..0e67aa0 100644 --- a/templates/default/bconsole.conf.erb +++ b/templates/default/bconsole.conf.erb @@ -4,7 +4,7 @@ # # Bareos User Agent (or Console) Configuration File -<% @bareos_dir.each do |director| %> +<% @bareos_dir.sort.each do |director| %> Director { Name = <%= director['bareos']['director']['name'] %>-dir address = <%= director['bareos']['director']['net_name'] %> diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index 73e5ff4..fbd766d 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -5,7 +5,7 @@ # Bareos Client Configuration File <% unless @clients.nil? %> - <% @clients.each do |client_key, client_value| %> + <% @clients.sort.each do |client_key, client_value| %> Client { Name = "<%= client_key %>" <% client_value.each do |key, value| %> @@ -15,7 +15,7 @@ Client { <% end %> <% end %> -<% @bareos_clients.each do |client| %> +<% @bareos_clients.sort.each do |client| %> Client { Name = "<%= client['bareos']['clients']['name'] %>-fd" Address = <%= client['bareos']['clients']['net_name'] %> diff --git a/templates/default/device-tape-with-autoloader.conf.erb b/templates/default/device-tape-with-autoloader.conf.erb index e1ef6a7..f6799ab 100644 --- a/templates/default/device-tape-with-autoloader.conf.erb +++ b/templates/default/device-tape-with-autoloader.conf.erb @@ -37,7 +37,7 @@ #### <%# AutoChanger Config %> -<% @autochangers.each do |autochanger_key, line_value1| %> +<% @autochangers.sort.each do |autochanger_key, line_value1| %> Autochanger { Name = <%= autochanger_key %> Description = "<%= autochanger_key %> Defined by Chef" @@ -50,7 +50,7 @@ Autochanger { <% end %> <%# Device Config %> -<% @devices.each do |device_key, line_value2| %> +<% @devices.sort.each do |device_key, line_value2| %> Device { Name = <%= device_key %> Description = "<%= device_key %> Defined by Chef" diff --git a/templates/default/dir_helper.conf.erb b/templates/default/dir_helper.conf.erb index 864e054..31daa8b 100644 --- a/templates/default/dir_helper.conf.erb +++ b/templates/default/dir_helper.conf.erb @@ -9,7 +9,7 @@ # inclusions or other bits not currently available in the base director template <% unless @dir_help.nil? %> - <% @dir_help.each do |helper_name, helper_str| %> + <% @dir_help.sort.each do |helper_name, helper_str| %> # <%= helper_name %> <%= helper_str %> diff --git a/templates/default/filesets.conf.erb b/templates/default/filesets.conf.erb index d5d0bb6..48bc968 100644 --- a/templates/default/filesets.conf.erb +++ b/templates/default/filesets.conf.erb @@ -4,7 +4,7 @@ # # Bareos Pool Definition File -<% @fileset_config.each do |fileset_name, section| -%> +<% @fileset_config.sort.each do |fileset_name, section| -%> FileSet { Name = "<%= fileset_name %>-fileset" Include { diff --git a/templates/default/job_definitions.conf.erb b/templates/default/job_definitions.conf.erb index 7f17fb0..617a807 100644 --- a/templates/default/job_definitions.conf.erb +++ b/templates/default/job_definitions.conf.erb @@ -5,7 +5,7 @@ # Bareos Job Definitions File <% unless @job_definitions.nil? %> - <% @job_definitions.each do |def_name, def_value| %> + <% @job_definitions.sort.each do |def_name, def_value| %> JobDefs { Name = "<%= def_name %>" <% def_value.each do |key,value| %> diff --git a/templates/default/jobs.conf.erb b/templates/default/jobs.conf.erb index a15d059..8f7accf 100644 --- a/templates/default/jobs.conf.erb +++ b/templates/default/jobs.conf.erb @@ -5,7 +5,7 @@ # Bareos Jobs File <% unless @jobs.nil? %> - <% @jobs.each do |job_key, job_value| %> + <% @jobs.sort.each do |job_key, job_value| %> Job { Name = "<%= job_key %>" <% job_value.each do |key, value| %> diff --git a/templates/default/pools.conf.erb b/templates/default/pools.conf.erb index 99d6a7f..171108f 100644 --- a/templates/default/pools.conf.erb +++ b/templates/default/pools.conf.erb @@ -4,7 +4,7 @@ # # Bareos Pool Definition File -<% @client_pools.each do |pool_name, pool| %> +<% @client_pools.sort.each do |pool_name, pool| %> Pool { Name = "<%= pool_name %>" <% pool.each do |key,value| %> diff --git a/templates/default/schedules.conf.erb b/templates/default/schedules.conf.erb index 358fe06..90aa987 100644 --- a/templates/default/schedules.conf.erb +++ b/templates/default/schedules.conf.erb @@ -4,7 +4,7 @@ # # Bareos Schedule Definitions File -<% @client_schedules.each do |sched_name, directive| %> +<% @client_schedules.sort.each do |sched_name, directive| %> Schedule { Name = "<%= sched_name %>" <% directive['Run'].each do |schedules| %> diff --git a/templates/default/sd_helper.conf.erb b/templates/default/sd_helper.conf.erb index edece72..943921a 100644 --- a/templates/default/sd_helper.conf.erb +++ b/templates/default/sd_helper.conf.erb @@ -9,7 +9,7 @@ # inclusions or other bits not currently available in the base storage daemon template <% unless @sd_help.nil? %> - <% @sd_help.each do |helper_name, helper_str| %> + <% @sd_help.sort.each do |helper_name, helper_str| %> # <%= helper_name %> <%= helper_str %> diff --git a/templates/default/storages.conf.erb b/templates/default/storages.conf.erb index 0ce9bd5..4bdd72b 100644 --- a/templates/default/storages.conf.erb +++ b/templates/default/storages.conf.erb @@ -4,7 +4,7 @@ # # Bareos Storage Definitions File -<% @client_storages.each do |stor_name, stor| %> +<% @client_storages.sort.each do |stor_name, stor| %> Storage { Name = "<%= stor_name %>" Password = "<%= node['bareos']['sd_password'] %>" From 4904e08ec859f4cd6431b74b31e70146907ee714 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 00:48:08 -0800 Subject: [PATCH 212/311] forgot to update the unmanaged_clients link to server recipe --- templates/default/clients.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index fbd766d..ec636b6 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -5,7 +5,7 @@ # Bareos Client Configuration File <% unless @clients.nil? %> - <% @clients.sort.each do |client_key, client_value| %> + <% @unmanaged_clients.sort.each do |client_key, client_value| %> Client { Name = "<%= client_key %>" <% client_value.each do |key, value| %> From ededc54e3a4b72e59fb0b072f546275dc656d58c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 10:09:20 -0800 Subject: [PATCH 213/311] adding a reload action as an optional feature, still restart by default --- attributes/default.rb | 25 +++++++++++++++++-------- metadata.rb | 2 +- recipes/server.rb | 12 +++++++++++- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 0ce9efe..29688b3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -108,6 +108,7 @@ default['bareos']['director']['heartbeat_interval'] = 600 default['bareos']['director']['catalog_jobdef'] = 'default-catalog-def' default['bareos']['director']['conf']['help']['Example Block'] = '# Put any extra configs you would like to include in the director config below this line. Chef manages this file so make sure you are using the attributes to apply them.' +default['bareos']['director']['config_change_notify'] = 'restart' # Subscription Management (Director) default['bareos']['director']['dir_subscription'] = nil @@ -130,18 +131,19 @@ } # Jobs - Example -# default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { -# 'Client' => "#{node['bareos']['clients']['name']}-fd", -# 'Type' => 'Backup', -# 'JobDefs' => 'default-def' +# default['bareos']['clients']['jobs']["# #{node.default['bareos']['clients']['name']}-job"] = { +# '# Client' => "#{node['bareos']['clients']['name']}-fd", +# '# Type' => 'Backup', +# '# JobDefs' => 'default-def' # } # -# default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { -# 'Client' => "#{node['bareos']['clients']['name']}-fd", -# 'Type' => 'Restore', -# 'JobDefs' => 'default-restore-def' +# default['bareos']['clients']['jobs']["# #{node.default['bareos']['clients']['name']}-restore-job"] = { +# '# Client' => "#{node['bareos']['clients']['name']}-fd", +# '# Type' => 'Restore', +# '# JobDefs' => 'default-restore-def' # } +default['bareos']['clients']['jobs'] = nil default['bareos']['server']['jobs'] = nil # Job Definitions @@ -232,6 +234,13 @@ 'Media Type' => 'File' } +default['bareos']['clients']['unmanaged']['# unmanaged-client-fd'] = { + '# Address' => 'unmanaged-client', + '# Password' => 'onefbofnerwob', + '# Catalog' => 'MyCatalog', + '# FDPort' => '9102' +} + # Developing Feature - Tape Autochanger Devices if node['bareos']['test_mode'] == true && node['bareos']['storage']['autochanger_enabled'] == true default['bareos']['storage']['autochangers']['autochanger-0'] = { diff --git a/metadata.rb b/metadata.rb index b35ac04..265a980 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.5' +version '2.2.6' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index f3edcef..82be4a6 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -156,7 +156,11 @@ subscribes :run, 'template[/etc/bareos/bareos-dir.d/jobs.conf]', :delayed subscribes :run, 'template[/etc/bareos/bareos-dir.d/clients.conf]', :delayed subscribes :run, 'template[/etc/bareos/bareos-dir.conf]', :delayed - notifies :restart, 'service[bareos-dir]', :delayed + if node['bareos']['director']['config_change_notify'] == 'restart' + notifies :restart, 'service[bareos-dir]', :delayed + else + notifies :run, 'execute[bareos-dir_reload]', :delayed + end end # Enable and start the bareos-dir service @@ -164,3 +168,9 @@ supports status: true, restart: true, reload: false action :enable end + +# Optional reload of the director config via execute +execute 'bareos-dir_reload' do + command 'echo reload | bconsole' + action :nothing +end From e7db053a7e38d4684c6fcec379a5971accf72b38 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 10:36:43 -0800 Subject: [PATCH 214/311] This cop has been updated, found from TraveCI Build failure --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3057bf2..cf64b45 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,7 +14,7 @@ MethodLength: Max: 30 NumericLiterals: Enabled: false -SingleSpaceBeforeFirstArg: +SpaceBeforeFirstArg: Enabled: false Metrics/LineLength: Max: 180 From c9adcbafa80ff4c0ffa01027604b411823d67b64 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 10:37:25 -0800 Subject: [PATCH 215/311] bumping centos7.1 to 7.2 so less updating is needed for testing, and it is current --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 71f43be..5eaf079 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -17,7 +17,7 @@ platforms: run_list: - recipe[apt] - name: centos-6.7 - - name: centos-7.1 + - name: centos-7.2 - name: fedora-20 - name: fedora-21 From ef0572a78cc545382f7413e136044f6032bb77dd Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 10:39:25 -0800 Subject: [PATCH 216/311] this was making wrapper test a hassle --- attributes/default.rb | 1 - metadata.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 29688b3..3bff3d2 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -143,7 +143,6 @@ # '# JobDefs' => 'default-restore-def' # } -default['bareos']['clients']['jobs'] = nil default['bareos']['server']['jobs'] = nil # Job Definitions diff --git a/metadata.rb b/metadata.rb index 265a980..33d595c 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.6' +version '2.2.7' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 34c49796ca7e04c4aa10c97f21d506a35ea0d1a4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 11:32:44 -0800 Subject: [PATCH 217/311] bumping to version 15.2 of bareos by default, fixing my repos for fedora, cleanup for Travis --- .kitchen.yml | 2 +- Vagrantfile | 2 +- attributes/default.rb | 10 +++++----- metadata.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 5eaf079..557ba9e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -18,8 +18,8 @@ platforms: - recipe[apt] - name: centos-6.7 - name: centos-7.2 - - name: fedora-20 - name: fedora-21 + - name: fedora-22 roles_path: test/integration/roles/ diff --git a/Vagrantfile b/Vagrantfile index 3cec5f1..55560bc 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ # vi: set ft=ruby : # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = '2' +VAGRANTFILE_API_VERSION = '2'.freeze Vagrant.require_version '>= 1.5.0' diff --git a/attributes/default.rb b/attributes/default.rb index 3bff3d2..9c76eb3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -5,7 +5,7 @@ # Used to have 'latest' as default, had potential update dangers # default['bareos']['version'] = 'latest' <--- Could be dangerous, ***CAUTION*** -default['bareos']['version'] = '14.2' # <--- Latest Stable version as of 05-Jan-2015 +default['bareos']['version'] = '15.2' # <--- Latest Stable version as of 06-Dec-2015 if platform_family?('rhel', 'fedora') default['bareos']['yum_repository'] = 'bareos' @@ -47,10 +47,10 @@ default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" end when 'fedora' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/Fedora_20/repodata/repomd.xml.key" - default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/Fedora_20/" - default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/Fedora_20/repodata/repomd.xml.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version']}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version']}/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/#{node['platform']}_#{node['platform_version']}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform']}_#{node['platform_version']}/repodata/repomd.xml.key" else default['bareos']['baseurl'] = nil default['bareos']['gpgkey'] = nil diff --git a/metadata.rb b/metadata.rb index 33d595c..b097124 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.7' +version '2.2.8' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 6bc6a03a3d7c51e4d0f4121325fef9fadf12950f Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 11:53:37 -0800 Subject: [PATCH 218/311] missed a spot for capitalize --- attributes/default.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 9c76eb3..df62d9f 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -47,10 +47,10 @@ default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform_family'].upcase}_#{node['platform_version'].to_i}/repodata/repomd.xml.key" end when 'fedora' - default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version']}/" - default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform']}_#{node['platform_version']}/repodata/repomd.xml.key" - default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/#{node['platform']}_#{node['platform_version']}/" - default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform']}_#{node['platform_version']}/repodata/repomd.xml.key" + default['bareos']['baseurl'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform'].capitalize}_#{node['platform_version']}/" + default['bareos']['gpgkey'] = "#{node['bareos']['url']}/#{node['bareos']['version']}/#{node['platform'].capitalize}_#{node['platform_version']}/repodata/repomd.xml.key" + default['bareos']['contrib_baseurl'] = "#{node['bareos']['contrib_url']}/#{node['platform'].capitalize}_#{node['platform_version']}/" + default['bareos']['contrib_gpgkey'] = "#{node['bareos']['contrib_url']}/#{node['platform'].capitalize}_#{node['platform_version']}/repodata/repomd.xml.key" else default['bareos']['baseurl'] = nil default['bareos']['gpgkey'] = nil From cc68d71871b9dcf32acea44504c0361a6ed094dc Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 12:11:04 -0800 Subject: [PATCH 219/311] removing a default unmanged host, messing with wrapper tests --- attributes/default.rb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index df62d9f..bd82c82 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -233,13 +233,6 @@ 'Media Type' => 'File' } -default['bareos']['clients']['unmanaged']['# unmanaged-client-fd'] = { - '# Address' => 'unmanaged-client', - '# Password' => 'onefbofnerwob', - '# Catalog' => 'MyCatalog', - '# FDPort' => '9102' -} - # Developing Feature - Tape Autochanger Devices if node['bareos']['test_mode'] == true && node['bareos']['storage']['autochanger_enabled'] == true default['bareos']['storage']['autochangers']['autochanger-0'] = { From 05c8865eea803752b8994e475df9af4883fa10d5 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 12:26:02 -0800 Subject: [PATCH 220/311] Bumping because 15.2 in centos6.7 needs epel repos for tests --- .kitchen.yml | 5 +++++ metadata.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 557ba9e..106b1e2 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -17,9 +17,14 @@ platforms: run_list: - recipe[apt] - name: centos-6.7 + run_list: + - recipe[yum-epel] - name: centos-7.2 + - recipe[yum-epel] - name: fedora-21 + - recipe[yum-epel] - name: fedora-22 + - recipe[yum-epel] roles_path: test/integration/roles/ diff --git a/metadata.rb b/metadata.rb index b097124..5177f83 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.8' +version '2.2.9' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -18,3 +18,4 @@ depends 'openssl' depends 'postgresql', '< 4.0.0' depends 'yum' +depends 'yum-epel' From 66233dddc4c026924348e91a54a3c84d14a40bef Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 12:57:17 -0800 Subject: [PATCH 221/311] missed a few runlist lines in kitchen file --- .kitchen.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 106b1e2..a18ee51 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -20,10 +20,13 @@ platforms: run_list: - recipe[yum-epel] - name: centos-7.2 + run_list: - recipe[yum-epel] - name: fedora-21 + run_list: - recipe[yum-epel] - name: fedora-22 + run_list: - recipe[yum-epel] roles_path: test/integration/roles/ From 4a44564fe988756c11b9ba93560e1e309bb49120 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 13:06:07 -0800 Subject: [PATCH 222/311] typo fix --- templates/default/clients.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/clients.conf.erb b/templates/default/clients.conf.erb index ec636b6..293ce0b 100644 --- a/templates/default/clients.conf.erb +++ b/templates/default/clients.conf.erb @@ -4,7 +4,7 @@ # # Bareos Client Configuration File -<% unless @clients.nil? %> +<% unless @unmanaged_clients.nil? %> <% @unmanaged_clients.sort.each do |client_key, client_value| %> Client { Name = "<%= client_key %>" From 6dfa12226e7e29a2904ceb2c5133fe35f9a8c505 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 13:06:25 -0800 Subject: [PATCH 223/311] typo fix bump --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 5177f83..8b85fdb 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.9' +version '2.2.10' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 8cadf8d76486b3c087f348293e73f1a34fb76c6b Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 13:42:40 -0800 Subject: [PATCH 224/311] fixing kitchen hashing examples, verify dir is started before reloading config, ver bump again --- .kitchen.yml | 18 ++++++++---------- metadata.rb | 2 +- recipes/server.rb | 1 + 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index a18ee51..e31ed17 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -39,11 +39,11 @@ suites: attributes: bareos: test_mode: true - server: + director: conf: - help: { + help: test: '# Some String' - } + config_change_notify: 'reload' - name: tape-storage run_list: @@ -54,11 +54,9 @@ suites: storage: autochanger_enabled: true server: - jobs: { - unmanaged-host-job: { - Description: '"Unmanaged Host Test Job"', - Client: 'unmanaged-client-fd', - JobDefs: 'default-def', + jobs: + unmanaged-host-job: + Description: '"Unmanaged Host Test Job"' + Client: 'unmanaged-client-fd' + JobDefs: 'default-def' Type: 'Backup' - } - } diff --git a/metadata.rb b/metadata.rb index 8b85fdb..c7f1a51 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.10' +version '2.2.11' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/server.rb b/recipes/server.rb index 82be4a6..d402bd8 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -159,6 +159,7 @@ if node['bareos']['director']['config_change_notify'] == 'restart' notifies :restart, 'service[bareos-dir]', :delayed else + notifies :start, 'service[bareos-dir]' notifies :run, 'execute[bareos-dir_reload]', :delayed end end From b8608c27527e63a8a4ba11e32e1fce061538bc5d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 14:13:45 -0800 Subject: [PATCH 225/311] director attribute not server --- attributes/default.rb | 2 +- metadata.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index bd82c82..4cbec16 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -143,7 +143,7 @@ # '# JobDefs' => 'default-restore-def' # } -default['bareos']['server']['jobs'] = nil +default['bareos']['director']['jobs'] = nil # Job Definitions default['bareos']['clients']['job_definitions']['default-def'] = { diff --git a/metadata.rb b/metadata.rb index c7f1a51..3a4818d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.11' +version '2.2.12' %w( centos redhat ).each do |os| supports os, '>= 6.0' From dabd7658e429bff17833026eef3802bbc72dedab Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Wed, 27 Jan 2016 14:48:03 -0800 Subject: [PATCH 226/311] attempting some rubocop cleanup for TravisCI --- metadata.rb | 2 +- recipes/client.rb | 2 +- recipes/server.rb | 2 +- recipes/storage.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index 3a4818d..68f57e5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.12' +version '2.2.13' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/client.rb b/recipes/client.rb index f0c155d..fdaee6c 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -28,7 +28,7 @@ # Determine the list of BAREOS directors dir_search_query = node.default['bareos']['director']['dir_search_query'] -if Chef::Config[:solo] +if Chef::Config.solo bareos_dir = node['bareos']['director']['servers'] else bareos_dir = search(:node, dir_search_query) diff --git a/recipes/server.rb b/recipes/server.rb index d402bd8..fa481e6 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -71,7 +71,7 @@ # Create clients config based on sets of hashes, see attributes file for default example(s) client_search_query = node['bareos']['clients']['client_search_query'] -if Chef::Config[:solo] +if Chef::Config.solo bareos_clients = node['bareos']['clients']['client_list'] else bareos_clients = search(:node, client_search_query) diff --git a/recipes/storage.rb b/recipes/storage.rb index 74246b2..e97165a 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -31,7 +31,7 @@ # Find Storage Daemon(s) and Director(s) storage_search_query = node['bareos']['storage']['storage_search_query'] dir_search_query = node['bareos']['director']['dir_search_query'] -if Chef::Config[:solo] +if Chef::Config.solo bareos_sd = node['bareos']['storage']['servers'] bareos_dir = node['bareos']['director']['servers'] else From a2cc00f09f718fd39bc77e59eefa7f741611951c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 00:31:04 -0800 Subject: [PATCH 227/311] Prepping README for more information later, cleanup basically --- README.md | 111 +++++++++++++----------------------------------------- 1 file changed, 26 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 474e206..1140f08 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,16 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare [Official BAREOS Documentation](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). # Requirements -The chef-bareos cookbook is still undergoing some extensive feature additions so it is recommended to watch for changes to the README/CHANGELOG and version lock any dependencies in your wrapper cookbook metadata file. Testing of new versions is highly recommended until we can say we have a majority of the sane defaults configured. Progress is being made but it is taking time. -## Supported Chef Versions: - * Chef 11 - * Chef 12 +## Supported Platforms: + * Ubuntu 12.04+ + * Debian 7 + * CentOS 6+ + * RHEL 6+ + * Fedora 21/22 -## Supported Operating Systems: - * RHEL 6/7 - * Fedora 19/20 - * Debian 6/7 - * Ubuntu 12.04 and higher +## Supported Chef Versions: + * Chef 11+ # Attributes @@ -26,98 +25,49 @@ The chef-bareos cookbook is still undergoing some extensive feature additions so Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['url'] | Base URL for Bareos Repository | string | 'http://download.bareos.org/bareos/release' -['bareos']['version'] | Software Version | string | '14.2' -OS Family | Attribute | Default ---------------|-----------|--------- -rhel/fedora |['bareos']['yum_repository'] | 'bareos' -rhel/fedora |['bareos']['description'] | 'Description of repo string' -varies | ['bareos']['baseurl'] | See attributes file -varies | ['bareos']['gpgkey'] | See attributes file +## Messages + +Attribute | Description | Type | Default +-----------------|-------------|------|--------- ## Database Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['database']['catalog_name'] | Catalog Name | string | 'MyCatalog' -['bareos']['database']['database_type'] | Database type | string | 'postgresql' -['bareos']['database']['dbdriver'] | Database driver | string | 'postgresql' -['bareos']['database']['dbname'] | Database default name | string | 'bareos' -['bareos']['database']['dbuser'] | Database user name | string | 'bareos' -['bareos']['database']['dbpassword'] | Database password | string | '' -['bareos']['database']['dbaddress'] | Database address | string | nil ## Clients Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['clients']['fd_port'] | | | 9102 -['bareos']['clients']['max_concurrent_jobs'] | | | 20 -['bareos']['clients']['client_list'] | | | {} -['bareos']['clients']['file_retention'] | | | '30 days' -['bareos']['clients']['job_retention'] | | | '6 months' -['bareos']['clients']['autoprune'] | | | 'no' -['bareos']['clients']['heartbeat_interval'] | | | 600 -['bareos']['clients']['jobdef_default_runlevel'] | | | 10 -['bareos']['clients']['jobdef_default_storage'] | | | 'File' -['bareos']['clients']['jobdef_default_messages'] | | | 'Standard' -['bareos']['clients']['jobdef_default_fileset'] | | | 'Full Set' -['bareos']['clients']['jobdef_default_schedule'] | | | 'WeeklyCycle' -['bareos']['clients']['host_pools'] | | | '0' -['bareos']['clients']['default_pool'] | | | 'Default' -['bareos']['clients']['full_pool'] | | | 'Full-Pool' -['bareos']['clients']['incremental_pool'] | | | 'Inc-Pool' -['bareos']['clients']['differential_pool'] | | | 'Diff-Pool' -['bareos']['clients']['enable_vfulls'] | | | false ## Storage Daemon Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['storage']['sd_port'] | | | 9103 -['bareos']['storage']['tape'] | | | false -['bareos']['storage']['servers'] | | | {} -['bareos']['storage']['custom_configs'] | | | '0' -['bareos']['storage']['sd_mon_enable'] | | | 'yes' -['bareos']['storage']['max_concurrent_jobs'] | | | 20 ## Director Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['director']['dir_port'] | | | 9101 -['bareos']['director']['dir_max_concurrent_jobs'] | | | 20 -['bareos']['director']['custom_configs'] | | | '1' -['bareos']['director']['servers'] | | | {} ## Subscription Management (Director) Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['dir_subscription'] | Support Subscription Status | boolean | nil/False -['bareos']['dir_subs'] | Subscription Level/Count | number | nil - -## Messages - -Attribute | Description | Type | Default ------------------|-------------|------|--------- -['bareos']['messages']['mail_to'] | | | "bareos@#{node['domain_name']}" -['bareos']['messages']['default_messages'] | | | 'Standard' ## Workstation Attribute | Description | Type | Default -----------------|-------------|------|--------- -['bareos']['workstation']['solo_mode'] | | | '0' # Basic Usage ## Roles -### bareos_client role (install the bareos client backup by default) +### Basic bareos\_client role (install the bareos client backup by default) You'll need a searchable client role named ``bareos_client``, for example : -``` +`` { "name": "bareos_client", "description": "Example Role for Bareos clients using the chef-bareos Cookbook, used in searches, throws down sources for installs", @@ -133,12 +83,12 @@ You'll need a searchable client role named ``bareos_client``, for example : "env_run_lists": { } } -``` +`` This role has to be applied to all your clients so they can be backed up by this cookbook. -### bareos_director role (install the bareos director for scheduling backups) -You'll need a searchable director role named ``bareos_director``, for example : -``` +### Basic bareos\_director role (install the bareos director for scheduling backups) +You'll need a searchable director role named ``bareos_director``, for example: +`` { "name": "bareos_director", "description": "Example Role for a Bareos director", @@ -157,16 +107,15 @@ You'll need a searchable director role named ``bareos_director``, for example : "env_run_lists": { } } -``` -You can replace the ``chef-bareos`` with an encompasing wrapper if desired. +`` You'll need to run chef-client on the backup server every time you add a new node. Client jobs should be created for you automatically. -Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of clients. +Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of client names. -### bareos_storage role (install the bareos storage daemon for data transfers) -You'll need a searchable storage role named ``bareos_storage``, for example : -``` +### Basic bareos\_storage role (install the bareos storage daemon for data transfers) +You'll need a searchable storage role named ``bareos_storage``, for example: +`` { "name": "bareos_storage", "description": "Example Role for a Bareos storage", @@ -182,17 +131,9 @@ You'll need a searchable storage role named ``bareos_storage``, for example : "env_run_lists": { } } -``` -You can replace the ``chef-bareos`` with a storage wrapper recipe. +`` ## Recipes (More detail coming) - * client - * database - * default - * repo - * server - * storage - * workstation # Contributing @@ -207,7 +148,7 @@ You can replace the ``chef-bareos`` with a storage wrapper recipe. ### License -``` +`` Copyright 2014 Léonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); @@ -221,7 +162,7 @@ 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. -``` +`` ### Authors From 785e7df2662ffb27a253a83dbf904129adb57d7a Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 00:31:43 -0800 Subject: [PATCH 228/311] Adding some notes to CHANGELOG to give a brief description of current state of cookbook and precautions when upgrading to newest version --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b6fecd..ea6953e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ Bareos Cookbook CHANGELOG This file is used to list changes made in each version of the bareos cookbook. +2.2.13 +----- +- Ian Smith + + - Near complete refactoring of how the cookbook works + * Adding various ways to add configs based on hashes. Examples in attributes/default.rb + - Updating README for usage details + - If you are not prepared to use this cookbook version, please lock cookbook version to < 2.0.0 + - TODO: Refactor the main bareos-dir/sd/fd to be fully base on hashes like other configs + * Remaining attributes support primary bareos-dir/sd/fd configs mostly, used elsewhere but not much + 1.0.4 ----- - Ian Smith From e739b7e97b18f88b99f4545af3ef4e2437864569 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 00:44:31 -0800 Subject: [PATCH 229/311] formatting --- README.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1140f08..4aa9f42 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare # Requirements ## Supported Platforms: + * Ubuntu 12.04+ * Debian 7 * CentOS 6+ @@ -17,6 +18,7 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare * Fedora 21/22 ## Supported Chef Versions: + * Chef 11+ # Attributes @@ -66,8 +68,10 @@ Attribute | Description | Type | Default ## Roles ### Basic bareos\_client role (install the bareos client backup by default) + You'll need a searchable client role named ``bareos_client``, for example : -`` +``` + { "name": "bareos_client", "description": "Example Role for Bareos clients using the chef-bareos Cookbook, used in searches, throws down sources for installs", @@ -83,12 +87,15 @@ You'll need a searchable client role named ``bareos_client``, for example : "env_run_lists": { } } -`` +``` + This role has to be applied to all your clients so they can be backed up by this cookbook. ### Basic bareos\_director role (install the bareos director for scheduling backups) -You'll need a searchable director role named ``bareos_director``, for example: -`` + +You'll need a searchable director role named ```bareos_director```, for example: +``` + { "name": "bareos_director", "description": "Example Role for a Bareos director", @@ -107,15 +114,18 @@ You'll need a searchable director role named ``bareos_director``, for example: "env_run_lists": { } } -`` + +``` You'll need to run chef-client on the backup server every time you add a new node. Client jobs should be created for you automatically. Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of client names. ### Basic bareos\_storage role (install the bareos storage daemon for data transfers) + You'll need a searchable storage role named ``bareos_storage``, for example: -`` +``` + { "name": "bareos_storage", "description": "Example Role for a Bareos storage", @@ -131,7 +141,8 @@ You'll need a searchable storage role named ``bareos_storage``, for example: "env_run_lists": { } } -`` + +``` ## Recipes (More detail coming) @@ -146,9 +157,8 @@ You'll need a searchable storage role named ``bareos_storage``, for example: ## License and Authors -### License +### License -`` Copyright 2014 Léonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); @@ -162,7 +172,6 @@ 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. -`` ### Authors From 7ea772f1ea2d1fcc85936baf614b5599143708c4 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 00:53:39 -0800 Subject: [PATCH 230/311] more formatting --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4aa9f42..bcf04c0 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,10 @@ Attribute | Description | Type | Default ## Roles -### Basic bareos\_client role (install the bareos client backup by default) +### Basic bareos\_client role +Install the Bareos Client so hosts can be backup automatically (required) -You'll need a searchable client role named ``bareos_client``, for example : +You'll need a searchable client role named ```bareos_client```, for example: ``` { @@ -91,7 +92,8 @@ You'll need a searchable client role named ``bareos_client``, for example : This role has to be applied to all your clients so they can be backed up by this cookbook. -### Basic bareos\_director role (install the bareos director for scheduling backups) +### Basic bareos\_director role +Install the Bareos Director for scheduling backups (required). You'll need a searchable director role named ```bareos_director```, for example: ``` @@ -121,9 +123,10 @@ You'll need to run chef-client on the backup server every time you add a new nod Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of client names. -### Basic bareos\_storage role (install the bareos storage daemon for data transfers) +### Basic bareos\_storage role +Install the Bareos Storage Daemon for data transfers (required). -You'll need a searchable storage role named ``bareos_storage``, for example: +You'll need a searchable storage role named ```bareos_storage```, for example: ``` { @@ -149,7 +152,7 @@ You'll need a searchable storage role named ``bareos_storage``, for example: # Contributing 1. Fork the repository on Github -2. Create a named feature branch (like `add_component_x`) +2. Create a named feature branch (like ```add_component_x```) 3. Write your change 4. Write tests for your change (if applicable) 5. Run the tests, ensuring they all pass From 14fa3da7f9322abbbef86aefb8835bc618c8a3af Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 00:57:37 -0800 Subject: [PATCH 231/311] Fixing a couple minor typos --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea6953e..c27387f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ This file is used to list changes made in each version of the bareos cookbook. * Adding various ways to add configs based on hashes. Examples in attributes/default.rb - Updating README for usage details - If you are not prepared to use this cookbook version, please lock cookbook version to < 2.0.0 - - TODO: Refactor the main bareos-dir/sd/fd to be fully base on hashes like other configs + - TODO: Refactor main bareos-dir/sd/fd configs to be fully based on hashes like other configs * Remaining attributes support primary bareos-dir/sd/fd configs mostly, used elsewhere but not much 1.0.4 From ed871b7bb698eb2c46581500104c04088bec39d6 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 01:06:15 -0800 Subject: [PATCH 232/311] adding the gitter badge from the master branch --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bcf04c0..46bcb2e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ Chef-Bareos Cookbook ==================== +[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). From 3c455659243c1f3be5288c0bfc81caadf57732e3 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 01:07:18 -0800 Subject: [PATCH 233/311] attempting a side-by-side --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 46bcb2e..20b7304 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ Chef-Bareos Cookbook ==================== -[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -[![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) +[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). From 06556d7aa66c5b30995e84ff983606b533e8e834 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 01:28:05 -0800 Subject: [PATCH 234/311] adding a description for each set of attributes and adding a better to prep for more info --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 20b7304..f8387bd 100644 --- a/README.md +++ b/README.md @@ -24,41 +24,49 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare # Attributes ## Repository +Assists with adding necessary sources for installing Bareos Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Messages +Defines default admin e-mail address for service notifications and what messages to care about Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Database +Prefills the Catalog resource in the main Director configuration Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Clients +Provides resources for the Catalog (Director configuration) and Filedaemon configurations/templates Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Storage Daemon +Provides for a baseline Storage Daemon Config with optional configurables Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Director +Provides standard variables for a typical Director configuration Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Subscription Management (Director) +Provides a system counter method if you have a paid service subscription Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Workstation +Provides a way to specify if you want to use fqdn or some other way to define host names in your deployment Attribute | Description | Type | Default -----------------|-------------|------|--------- @@ -147,7 +155,7 @@ You'll need a searchable storage role named ```bareos_storage```, for example: ``` -## Recipes (More detail coming) +## Recipes and Configurations based on hashes # Contributing From 63eb1b8dc63c0f4a44412aa6ebbed0936a22d84d Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 01:31:16 -0800 Subject: [PATCH 235/311] minor changes to wording --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8387bd..f61d9d4 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Attribute | Description | Type | Default -----------------|-------------|------|--------- ## Workstation -Provides a way to specify if you want to use fqdn or some other way to define host names in your deployment +Determines if you want to use FQDN or some other way of defining hosts in your management workstation deployment Attribute | Description | Type | Default -----------------|-------------|------|--------- From 3f2328af845df0b26089b2cbc710077465ed539c Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Thu, 28 Jan 2016 01:40:05 -0800 Subject: [PATCH 236/311] adding placeholder for areas that need filled in with specifics and examples --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f61d9d4..67be227 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,30 @@ You'll need a searchable storage role named ```bareos_storage```, for example: ``` -## Recipes and Configurations based on hashes +## Recipes and Hashable Configurations + +### Recipes +#### default.rb +#### client.rb +#### repo.rb +#### database.rb +#### server.rb +#### storage.rb +#### autochanger.rb +#### workstation.rb + +### Hashable Configurations (via templates) +#### bconsole +#### clients +#### autochanger +#### dir\_helper +#### filesets +#### job\_definitions (jobdefs) +#### jobs +#### pools +#### schedules +#### sd\_helper +#### storages # Contributing From ca3f32fe5d297015ee4fc77ca8be9c38f24c7946 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Sun, 31 Jan 2016 02:07:27 -0800 Subject: [PATCH 237/311] Got the variable rubocop warnings cleaned up finally --- metadata.rb | 2 +- recipes/client.rb | 10 +++++----- recipes/server.rb | 11 ++++++----- recipes/workstation.rb | 10 +++++----- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/metadata.rb b/metadata.rb index 68f57e5..8268e05 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.13' +version '2.2.14' %w( centos redhat ).each do |os| supports os, '>= 6.0' diff --git a/recipes/client.rb b/recipes/client.rb index fdaee6c..a84c52d 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -28,11 +28,11 @@ # Determine the list of BAREOS directors dir_search_query = node.default['bareos']['director']['dir_search_query'] -if Chef::Config.solo - bareos_dir = node['bareos']['director']['servers'] -else - bareos_dir = search(:node, dir_search_query) -end +bareos_dir = if Chef::Config[:solo] + node['bareos']['director']['servers'] + else + search(:node, dir_search_query) + end # Setup the configs for any local/remote File Daemons clients template '/etc/bareos/bareos-fd.conf' do diff --git a/recipes/server.rb b/recipes/server.rb index fa481e6..531a6fc 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -71,11 +71,12 @@ # Create clients config based on sets of hashes, see attributes file for default example(s) client_search_query = node['bareos']['clients']['client_search_query'] -if Chef::Config.solo - bareos_clients = node['bareos']['clients']['client_list'] -else - bareos_clients = search(:node, client_search_query) -end +bareos_clients = if Chef::Config[:solo] + node['bareos']['clients']['client_list'] + else + search(:node, client_search_query) + end + template '/etc/bareos/bareos-dir.d/clients.conf' do source 'clients.conf.erb' owner 'bareos' diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 6147de3..04acbed 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -24,11 +24,11 @@ # Find director(s) dir_search_query = node['bareos']['director']['dir_search_query'] -if Chef::Config[:solo] - bareos_dir = node['bareos']['director']['servers'] -else - bareos_dir = search(:node, dir_search_query) -end +bareos_dir = if Chef::Config[:solo] + node['bareos']['director']['servers'] + else + search(:node, dir_search_query) + end # bconsole config template '/etc/bareos/bconsole.conf' do From e58295ee5994596db824070f649036f7bcc8f853 Mon Sep 17 00:00:00 2001 From: Ian Smith Date: Mon, 8 Feb 2016 14:51:49 -0800 Subject: [PATCH 238/311] cleaning up some unused attributes, leftovers from old versions --- attributes/default.rb | 12 +++++------- metadata.rb | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 4cbec16..6aecd89 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -81,16 +81,14 @@ default['bareos']['clients']['client_search_query'] = 'roles:bareos_client' default['bareos']['clients']['client_list'] = %w(node) default['bareos']['clients']['bootstrap_file'] = '/var/lib/bareos/%c.bsr' -default['bareos']['clients']['jobdef_default_messages'] = node['bareos']['messages']['default_messages'] -default['bareos']['clients']['jobdef_default_storage'] = 'File' +default['bareos']['clients']['jobdef_default_messages'] = 'Standard' default['bareos']['clients']['jobdef_default_fileset'] = "#{node['fqdn']}-Fileset" -default['bareos']['clients']['storage'] = node['bareos']['clients']['jobdef_default_storage'] +default['bareos']['clients']['storage'] = 'File' # Storage Daemon default['bareos']['storage']['name'] = node['fqdn'] default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' default['bareos']['storage']['sd_port'] = 9103 -default['bareos']['storage']['main_storage'] = 'File' default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 @@ -117,9 +115,9 @@ # Workstation default['bareos']['workstation']['name'] = node['fqdn'] -########################## -# Example Default Hashes # -########################## +############################## +# Examples - Default Hashes # +############################## # General Client Config default['bareos']['clients']['conf'] = { diff --git a/metadata.rb b/metadata.rb index 8268e05..2383fc4 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.14' +version '2.2.15' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 8a676c7f73de684b6bae41c73dd1dfc881b8f32f Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 12:24:40 -0800 Subject: [PATCH 239/311] cleaning up my integration testing a bit, adding some alpha unit testing --- spec/spec_helper.rb | 4 + spec/unit/recipes/repo_spec.rb | 29 ++++++ .../aio-server-pools/serverspec/.rspec | 2 - .../serverspec/spec/spec_helper.rb | 89 ------------------- .../serverspec/spec_helper.rb | 16 ---- .../serverspec/aio-server_spec.rb} | 0 .../aio-server/serverspec/spec/spec_helper.rb | 89 ------------------- .../tape-storage/serverspec/bareos_spec.rb | 30 ------- .../serverspec/spec/spec_helper.rb | 89 ------------------- .../serverspec/tape-storage_spec.rb} | 0 10 files changed, 33 insertions(+), 315 deletions(-) create mode 100644 spec/spec_helper.rb create mode 100644 spec/unit/recipes/repo_spec.rb delete mode 100644 test/integration/aio-server-pools/serverspec/.rspec delete mode 100644 test/integration/aio-server-pools/serverspec/spec/spec_helper.rb delete mode 100644 test/integration/aio-server-pools/serverspec/spec_helper.rb rename test/integration/{aio-server-pools/serverspec/bareos_spec.rb => aio-server/serverspec/aio-server_spec.rb} (100%) delete mode 100644 test/integration/aio-server/serverspec/spec/spec_helper.rb delete mode 100644 test/integration/tape-storage/serverspec/bareos_spec.rb delete mode 100644 test/integration/tape-storage/serverspec/spec/spec_helper.rb rename test/integration/{aio-server/serverspec/bareos_spec.rb => tape-storage/serverspec/tape-storage_spec.rb} (100%) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..4e00004 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,4 @@ +require 'chefspec' +require 'chefspec/berkshelf' + +at_exit { ChefSpec::Coverage.report! } diff --git a/spec/unit/recipes/repo_spec.rb b/spec/unit/recipes/repo_spec.rb new file mode 100644 index 0000000..db84ce5 --- /dev/null +++ b/spec/unit/recipes/repo_spec.rb @@ -0,0 +1,29 @@ +# Test that the repo is being put on the box as desired + +require 'spec_helper' + +describe 'chef-bareos::repo' do + context 'Source is needed,' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge(described_recipe) + end + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + it 'installing repo...' + end + + context 'Packages required,' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge(described_recipe) + end + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + it 'updating yum cache for main bareos packages...' do + expect { chef_run }.to yum_repository(default['bareos']['yum_repository']) + end + end +end diff --git a/test/integration/aio-server-pools/serverspec/.rspec b/test/integration/aio-server-pools/serverspec/.rspec deleted file mode 100644 index 83e16f8..0000000 --- a/test/integration/aio-server-pools/serverspec/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb b/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end diff --git a/test/integration/aio-server-pools/serverspec/spec_helper.rb b/test/integration/aio-server-pools/serverspec/spec_helper.rb deleted file mode 100644 index 8763eb5..0000000 --- a/test/integration/aio-server-pools/serverspec/spec_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'serverspec' - -set :backend, :exec - -RSpec.configure do |c| - c.before :all do - set :path, '$PATH:/sbin:/usr/local/sbin' - end - - if ENV['ASK_SUDO_PASSWORD'] - require 'highline/import' - c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false } - else - c.sudo_password = ENV['SUDO_PASSWORD'] - end -end diff --git a/test/integration/aio-server-pools/serverspec/bareos_spec.rb b/test/integration/aio-server/serverspec/aio-server_spec.rb similarity index 100% rename from test/integration/aio-server-pools/serverspec/bareos_spec.rb rename to test/integration/aio-server/serverspec/aio-server_spec.rb diff --git a/test/integration/aio-server/serverspec/spec/spec_helper.rb b/test/integration/aio-server/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/aio-server/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end diff --git a/test/integration/tape-storage/serverspec/bareos_spec.rb b/test/integration/tape-storage/serverspec/bareos_spec.rb deleted file mode 100644 index b6b14ce..0000000 --- a/test/integration/tape-storage/serverspec/bareos_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -# Check Packages are installed -describe package('bareos-filedaemon') do - it { should be_installed } -end - -describe package('bareos-storage') do - it { should be_installed } -end - -describe package('bareos-director') do - it { should be_installed } -end - -# Check Services are running and enabled -describe service('bareos-fd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-sd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-dir') do - it { should be_enabled } - it { should be_running } -end diff --git a/test/integration/tape-storage/serverspec/spec/spec_helper.rb b/test/integration/tape-storage/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/tape-storage/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end diff --git a/test/integration/aio-server/serverspec/bareos_spec.rb b/test/integration/tape-storage/serverspec/tape-storage_spec.rb similarity index 100% rename from test/integration/aio-server/serverspec/bareos_spec.rb rename to test/integration/tape-storage/serverspec/tape-storage_spec.rb From df6e5299b0002a47d538e7cb0072163a2f8cefd2 Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 13:20:42 -0800 Subject: [PATCH 240/311] This is starting to work for me a little better, getting some os seperation as well --- spec/unit/recipes/repo_spec.rb | 54 ++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/spec/unit/recipes/repo_spec.rb b/spec/unit/recipes/repo_spec.rb index db84ce5..0e8c09f 100644 --- a/spec/unit/recipes/repo_spec.rb +++ b/spec/unit/recipes/repo_spec.rb @@ -3,27 +3,45 @@ require 'spec_helper' describe 'chef-bareos::repo' do - context 'Source is needed,' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge(described_recipe) - end - it 'converges successfully' do - expect { chef_run }.to_not raise_error + + + ['6.7', '7.2.1511'].each do |version| + context "on CentOS #{version}" do + before do + Fauxhai.mock(platform: 'CentOS', version: version) + end + + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge('chef-bareos::repo') + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'should install bareos repo' + it 'should install bareos contrib repo' end - it 'installing repo...' end - context 'Packages required,' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge(described_recipe) - end - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - it 'updating yum cache for main bareos packages...' do - expect { chef_run }.to yum_repository(default['bareos']['yum_repository']) + ['12.04', '14.04'].each do |version| + context "on Ubuntu #{version}" do + before do + Fauxhai.mock(platform: 'ubuntu', version: version) + end + + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge('chef-bareos::repo') + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'should install bareos repo' + it 'should install bareos contrib repo' end end end From d0d25854db407ab77d707f617874e0234e5082c3 Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 16:30:42 -0800 Subject: [PATCH 241/311] need to plan these tests out a bit more, skeleton in place, needs work.. --- spec/unit/recipes/repo_spec.rb | 38 ++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/spec/unit/recipes/repo_spec.rb b/spec/unit/recipes/repo_spec.rb index 0e8c09f..840a9f6 100644 --- a/spec/unit/recipes/repo_spec.rb +++ b/spec/unit/recipes/repo_spec.rb @@ -3,25 +3,28 @@ require 'spec_helper' describe 'chef-bareos::repo' do - - ['6.7', '7.2.1511'].each do |version| context "on CentOS #{version}" do before do - Fauxhai.mock(platform: 'CentOS', version: version) + Fauxhai.mock(platform: 'centos', version: version) end let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge('chef-bareos::repo') + ChefSpec::SoloRunner.new do |node| + end.converge('chef-bareos::repo') end it 'converges successfully' do expect { chef_run }.to_not raise_error end - it 'should install bareos repo' - it 'should install bareos contrib repo' + it 'should add bareos yum repo' do + # expect(chef_run).to add_yum_repository('bareos') + end + + it 'should add bareos_contrib yum repo' do + # expect(chef_run).to add_yum_repository('bareos_contrib') + end end end @@ -32,16 +35,29 @@ end let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge('chef-bareos::repo') + ChefSpec::SoloRunner.new do |node| + end.converge('chef-bareos::repo') end it 'converges successfully' do expect { chef_run }.to_not raise_error end - it 'should install bareos repo' - it 'should install bareos contrib repo' + it 'should add bareos apt repo' do + # expect(chef_run).to add_apt_repository('bareos').with( + # 'uri' => node['bareos']['baseurl'], + # 'key' => node['bareos']['gpgkey'], + # 'components' => ['/'] + # ) + end + + it 'should add bareos_contrib apt repo' do + # expect(chef_run).to add_apt_repository('bareos_contrib').with( + # 'uri' => node['bareos']['contrib_baseurl'], + # 'key' => node['bareos']['contrib_gpgkey'], + # 'components' => ['/'] + # ) + end end end end From 11ee57cf8ae94d851def5d14a44fba3a43570992 Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 16:38:08 -0800 Subject: [PATCH 242/311] adding lamont's unit test from late last year finally.. --- spec/unit/recipes/default_spec.rb | 68 +++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 spec/unit/recipes/default_spec.rb diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb new file mode 100644 index 0000000..d8c8a00 --- /dev/null +++ b/spec/unit/recipes/default_spec.rb @@ -0,0 +1,68 @@ +# +# Cookbook Name:: chef-bareos +# Spec:: default +# +# Copyright (c) 2015 The Authors, All Rights Reserved. + +require 'spec_helper' + +describe 'chef-bareos::default' do + before do + allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original + allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') + end + + context 'When all attributes are default, on an unspecified platform' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'includes the client recipe' do + expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') + chef_run + end + + # it 'includes the openssl recipe' do + # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') + # chef_run + # end + end + + context 'on an ubuntu 12.04 box' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'adds the apt repo' do + expect(chef_run).to add_apt_repository('bareos') + end + end + + context 'on an centos 6.6 box' do + let(:chef_run) do + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| + node.set['bareos']['yum_repository'] = 'bareos-repo-test' + node.set['bareos']['baseurl'] = 'http://foo/bar' + end + runner.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'adds the yum repo' do + expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') + end + end +end From cbbd3c9d19ecc1ab00cb9803da216b97cf27a4b9 Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 16:38:55 -0800 Subject: [PATCH 243/311] removing placeholder --- test/future_unit_tests/spec/spec_helper.rb | 4 -- .../spec/unit/recipes/default_spec.rb | 68 ------------------- 2 files changed, 72 deletions(-) delete mode 100644 test/future_unit_tests/spec/spec_helper.rb delete mode 100644 test/future_unit_tests/spec/unit/recipes/default_spec.rb diff --git a/test/future_unit_tests/spec/spec_helper.rb b/test/future_unit_tests/spec/spec_helper.rb deleted file mode 100644 index cef8e46..0000000 --- a/test/future_unit_tests/spec/spec_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' - -ChefSpec::Coverage.start! diff --git a/test/future_unit_tests/spec/unit/recipes/default_spec.rb b/test/future_unit_tests/spec/unit/recipes/default_spec.rb deleted file mode 100644 index d8c8a00..0000000 --- a/test/future_unit_tests/spec/unit/recipes/default_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -# -# Cookbook Name:: chef-bareos -# Spec:: default -# -# Copyright (c) 2015 The Authors, All Rights Reserved. - -require 'spec_helper' - -describe 'chef-bareos::default' do - before do - allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original - allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') - end - - context 'When all attributes are default, on an unspecified platform' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'includes the client recipe' do - expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') - chef_run - end - - # it 'includes the openssl recipe' do - # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') - # chef_run - # end - end - - context 'on an ubuntu 12.04 box' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'adds the apt repo' do - expect(chef_run).to add_apt_repository('bareos') - end - end - - context 'on an centos 6.6 box' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| - node.set['bareos']['yum_repository'] = 'bareos-repo-test' - node.set['bareos']['baseurl'] = 'http://foo/bar' - end - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'adds the yum repo' do - expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') - end - end -end From f9672c31d8f2a662dede0cdf92d715b19832f16b Mon Sep 17 00:00:00 2001 From: I Smith Date: Wed, 24 Feb 2016 16:53:31 -0800 Subject: [PATCH 244/311] Lamont's test=awesome, my test..not there.. still, success is good --- spec/unit/recipes/default_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index d8c8a00..0bf2355 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -43,9 +43,13 @@ expect { chef_run }.to_not raise_error end - it 'adds the apt repo' do + it 'adds the apt repo bareos' do expect(chef_run).to add_apt_repository('bareos') end + + it 'adds the apt repo bareos_contrib' do + expect(chef_run).to add_apt_repository('bareos_contrib') + end end context 'on an centos 6.6 box' do @@ -61,8 +65,12 @@ expect { chef_run }.to_not raise_error end - it 'adds the yum repo' do + it 'adds the yum repo bareos' do expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') end + + it 'adds the yum repo bareos_contrib' do + expect(chef_run).to create_yum_repository('bareos_contrib').with(baseurl: 'http://download.bareos.org/bareos/contrib/CentOS_6/') + end end end From 307b55d1b56400d58cd22fb93ac24cf8f7e5ea5a Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:45:35 -0700 Subject: [PATCH 245/311] removing unnecessary tests --- .../tape-storage/serverspec/.rspec | 2 -- .../tape-storage/serverspec/bareos_spec.rb | 30 ------------------- .../tape-storage/serverspec/spec_helper.rb | 16 ---------- 3 files changed, 48 deletions(-) delete mode 100644 test/integration/tape-storage/serverspec/.rspec delete mode 100644 test/integration/tape-storage/serverspec/bareos_spec.rb delete mode 100644 test/integration/tape-storage/serverspec/spec_helper.rb diff --git a/test/integration/tape-storage/serverspec/.rspec b/test/integration/tape-storage/serverspec/.rspec deleted file mode 100644 index 83e16f8..0000000 --- a/test/integration/tape-storage/serverspec/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/test/integration/tape-storage/serverspec/bareos_spec.rb b/test/integration/tape-storage/serverspec/bareos_spec.rb deleted file mode 100644 index b6b14ce..0000000 --- a/test/integration/tape-storage/serverspec/bareos_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -# Check Packages are installed -describe package('bareos-filedaemon') do - it { should be_installed } -end - -describe package('bareos-storage') do - it { should be_installed } -end - -describe package('bareos-director') do - it { should be_installed } -end - -# Check Services are running and enabled -describe service('bareos-fd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-sd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-dir') do - it { should be_enabled } - it { should be_running } -end diff --git a/test/integration/tape-storage/serverspec/spec_helper.rb b/test/integration/tape-storage/serverspec/spec_helper.rb deleted file mode 100644 index 8763eb5..0000000 --- a/test/integration/tape-storage/serverspec/spec_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'serverspec' - -set :backend, :exec - -RSpec.configure do |c| - c.before :all do - set :path, '$PATH:/sbin:/usr/local/sbin' - end - - if ENV['ASK_SUDO_PASSWORD'] - require 'highline/import' - c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false } - else - c.sudo_password = ENV['SUDO_PASSWORD'] - end -end From 97c6feb6b081cebeff486be0b46d1212652fd649 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:47:16 -0700 Subject: [PATCH 246/311] renaming the primary integration test Only needed one main integration test in the end --- .../{aio-server => bareos-aio-server}/serverspec/.rspec | 0 .../{aio-server => bareos-aio-server}/serverspec/bareos_spec.rb | 0 .../serverspec/spec/spec_helper.rb | 0 .../{aio-server => bareos-aio-server}/serverspec/spec_helper.rb | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename test/integration/{aio-server => bareos-aio-server}/serverspec/.rspec (100%) rename test/integration/{aio-server => bareos-aio-server}/serverspec/bareos_spec.rb (100%) rename test/integration/{aio-server => bareos-aio-server}/serverspec/spec/spec_helper.rb (100%) rename test/integration/{aio-server => bareos-aio-server}/serverspec/spec_helper.rb (100%) diff --git a/test/integration/aio-server/serverspec/.rspec b/test/integration/bareos-aio-server/serverspec/.rspec similarity index 100% rename from test/integration/aio-server/serverspec/.rspec rename to test/integration/bareos-aio-server/serverspec/.rspec diff --git a/test/integration/aio-server/serverspec/bareos_spec.rb b/test/integration/bareos-aio-server/serverspec/bareos_spec.rb similarity index 100% rename from test/integration/aio-server/serverspec/bareos_spec.rb rename to test/integration/bareos-aio-server/serverspec/bareos_spec.rb diff --git a/test/integration/aio-server/serverspec/spec/spec_helper.rb b/test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb similarity index 100% rename from test/integration/aio-server/serverspec/spec/spec_helper.rb rename to test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb diff --git a/test/integration/aio-server/serverspec/spec_helper.rb b/test/integration/bareos-aio-server/serverspec/spec_helper.rb similarity index 100% rename from test/integration/aio-server/serverspec/spec_helper.rb rename to test/integration/bareos-aio-server/serverspec/spec_helper.rb From 8046fd0e518841af02736bd09de87be7062d9581 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:47:51 -0700 Subject: [PATCH 247/311] removing unnecessary tests --- .../aio-server-pools/serverspec/.rspec | 2 - .../serverspec/bareos_spec.rb | 30 ------- .../serverspec/spec/spec_helper.rb | 89 ------------------- .../serverspec/spec_helper.rb | 16 ---- 4 files changed, 137 deletions(-) delete mode 100644 test/integration/aio-server-pools/serverspec/.rspec delete mode 100644 test/integration/aio-server-pools/serverspec/bareos_spec.rb delete mode 100644 test/integration/aio-server-pools/serverspec/spec/spec_helper.rb delete mode 100644 test/integration/aio-server-pools/serverspec/spec_helper.rb diff --git a/test/integration/aio-server-pools/serverspec/.rspec b/test/integration/aio-server-pools/serverspec/.rspec deleted file mode 100644 index 83e16f8..0000000 --- a/test/integration/aio-server-pools/serverspec/.rspec +++ /dev/null @@ -1,2 +0,0 @@ ---color ---require spec_helper diff --git a/test/integration/aio-server-pools/serverspec/bareos_spec.rb b/test/integration/aio-server-pools/serverspec/bareos_spec.rb deleted file mode 100644 index b6b14ce..0000000 --- a/test/integration/aio-server-pools/serverspec/bareos_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper' - -# Check Packages are installed -describe package('bareos-filedaemon') do - it { should be_installed } -end - -describe package('bareos-storage') do - it { should be_installed } -end - -describe package('bareos-director') do - it { should be_installed } -end - -# Check Services are running and enabled -describe service('bareos-fd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-sd') do - it { should be_enabled } - it { should be_running } -end - -describe service('bareos-dir') do - it { should be_enabled } - it { should be_running } -end diff --git a/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb b/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/aio-server-pools/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end diff --git a/test/integration/aio-server-pools/serverspec/spec_helper.rb b/test/integration/aio-server-pools/serverspec/spec_helper.rb deleted file mode 100644 index 8763eb5..0000000 --- a/test/integration/aio-server-pools/serverspec/spec_helper.rb +++ /dev/null @@ -1,16 +0,0 @@ -require 'serverspec' - -set :backend, :exec - -RSpec.configure do |c| - c.before :all do - set :path, '$PATH:/sbin:/usr/local/sbin' - end - - if ENV['ASK_SUDO_PASSWORD'] - require 'highline/import' - c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false } - else - c.sudo_password = ENV['SUDO_PASSWORD'] - end -end From 5579bfded7b55ad8e869bb6660033c8997318ba6 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:48:36 -0700 Subject: [PATCH 248/311] removing unnecessary tests --- .../serverspec/spec/spec_helper.rb | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 test/integration/tape-storage/serverspec/spec/spec_helper.rb diff --git a/test/integration/tape-storage/serverspec/spec/spec_helper.rb b/test/integration/tape-storage/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/tape-storage/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end From 4fb49151273f791ef77a1ce1cf907f7258ad9439 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:49:24 -0700 Subject: [PATCH 249/311] already working on some better chefspec tests, these can go now. --- test/future_unit_tests/spec/spec_helper.rb | 4 -- .../spec/unit/recipes/default_spec.rb | 68 ------------------- 2 files changed, 72 deletions(-) delete mode 100644 test/future_unit_tests/spec/spec_helper.rb delete mode 100644 test/future_unit_tests/spec/unit/recipes/default_spec.rb diff --git a/test/future_unit_tests/spec/spec_helper.rb b/test/future_unit_tests/spec/spec_helper.rb deleted file mode 100644 index cef8e46..0000000 --- a/test/future_unit_tests/spec/spec_helper.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' - -ChefSpec::Coverage.start! diff --git a/test/future_unit_tests/spec/unit/recipes/default_spec.rb b/test/future_unit_tests/spec/unit/recipes/default_spec.rb deleted file mode 100644 index d8c8a00..0000000 --- a/test/future_unit_tests/spec/unit/recipes/default_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -# -# Cookbook Name:: chef-bareos -# Spec:: default -# -# Copyright (c) 2015 The Authors, All Rights Reserved. - -require 'spec_helper' - -describe 'chef-bareos::default' do - before do - allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).and_call_original - allow_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') - end - - context 'When all attributes are default, on an unspecified platform' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'includes the client recipe' do - expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') - chef_run - end - - # it 'includes the openssl recipe' do - # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') - # chef_run - # end - end - - context 'on an ubuntu 12.04 box' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'adds the apt repo' do - expect(chef_run).to add_apt_repository('bareos') - end - end - - context 'on an centos 6.6 box' do - let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| - node.set['bareos']['yum_repository'] = 'bareos-repo-test' - node.set['bareos']['baseurl'] = 'http://foo/bar' - end - runner.converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end - - it 'adds the yum repo' do - expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') - end - end -end From c4af39a37c5cdd864329c9327c02fef3a119f905 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 15:51:06 -0700 Subject: [PATCH 250/311] merging both tests together to just make an aio server --- .kitchen.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index e31ed17..d0ed2af 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -32,8 +32,7 @@ platforms: roles_path: test/integration/roles/ suites: - - - name: aio-server + - name: bareos-aio-server run_list: - role[bareos_director] attributes: @@ -44,19 +43,12 @@ suites: help: test: '# Some String' config_change_notify: 'reload' - - - name: tape-storage - run_list: - - role[bareos_director] - attributes: - bareos: - test_mode: true - storage: - autochanger_enabled: true server: jobs: - unmanaged-host-job: + unmanaged-host-job: Description: '"Unmanaged Host Test Job"' Client: 'unmanaged-client-fd' JobDefs: 'default-def' Type: 'Backup' + storage: + autochanger_enabled: true From 929557849d760dcebed20d07969775cbe1e75605 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:46:24 -0700 Subject: [PATCH 251/311] not reliant on tailor testing that I am aware of, serverspec and chefspec --- .tailor | 138 -------------------------------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 .tailor diff --git a/.tailor b/.tailor deleted file mode 100644 index 75f326a..0000000 --- a/.tailor +++ /dev/null @@ -1,138 +0,0 @@ -#------------------------------------------------------------------------------ -# Horizontal Whitespace -#------------------------------------------------------------------------------ -# allow_hard_tabs True to let hard tabs be considered a single space. -# Default: false -# -# allow_trailing_line_spaces -# True to skip detecting extra spaces at the ends of -# lines. -# Default: false -# -# indentation_spaces The number of spaces to consider a proper indent. -# Default: 2 -# -# Option: line_continuations -# Indicates that a statement that spans multiple lines -# should indent the second and subsequent lines. Ex.: -# style.indentation_spaces 2, level: :error, line_continuations: true -# -# Option: argument_align -# Allowing you to specify that method declarations and -# calls should indent to the first argument on -# subsequent lines. Ex.: -# style.indentation_spaces 2, level: :error, argument_alignment: true -# -# max_line_length The maximum number of characters in a line before -# tailor complains. -# Default: 80 -# spaces_after_comma Number of spaces to expect after a comma. -# Default: 1 -# -# spaces_before_comma Number of spaces to expect before a comma. -# Default: 0 -# -# spaces_after_lbrace The number of spaces to expect after an lbrace ('{'). -# Default: 1 -# -# spaces_before_lbrace The number of spaces to expect before an lbrace ('{'). -# Default: 1 -# -# spaces_before_rbrace The number of spaces to expect before an rbrace ('}'). -# Default: 1 -# -# spaces_in_empty_braces The number of spaces to expect between braces when -# there's nothing in the braces (i.e. {}). -# Default: 0 -# -# spaces_after_lbracket The number of spaces to expect after an -# lbracket ('['). -# Default: 0 -# -# spaces_before_rbracket The number of spaces to expect before an -# rbracket (']'). -# Default: 0 -# -# spaces_after_lparen The number of spaces to expect after an -# lparen ('('). -# Default: 0 -# -# spaces_before_rparen The number of spaces to expect before an -# rbracket (')'). -# Default: 0 -# -#------------------------------------------------------------------------------ -# Naming -#------------------------------------------------------------------------------ -# allow_camel_case_methods -# Setting to true skips detection of camel-case method -# names (i.e. def myMethod). -# Default: false -# -# allow_screaming_snake_case_classes -# Setting to true skips detection of screaming -# snake-case class names (i.e. My_Class). -# Default: false -# -#------------------------------------------------------------------------------ -# Vertical Whitespace -#------------------------------------------------------------------------------ -# max_code_lines_in_class The number of lines of code in a class to allow before -# tailor will warn you. -# Default: 300 -# -# max_code_lines_in_method -# The number of lines of code in a method to allow -# before tailor will warn you. -# Default: 30 -# -# trailing_newlines The number of newlines that should be at the end of -# the file. -# Default: 1 -# -#------------------------------------------------------------------------------ -# Common Syntax -#------------------------------------------------------------------------------ -# allow_conditional_parentheses -# Checks to see if a conditional is unnecessarily -# wrapped in parentheses. -# Default: true -# -# allow_unnecessary_double_quotes -# Checks for use of double-quotes when no interpolation -# is used. -# Default: false -# -# allow_unnecessary_interpolation -# Checks for unnecessary interpolation in strings. -# Default: false -# -Tailor.config do |config| - config.formatters "text" - config.file_set '**/*.rb' do |style| - style.allow_camel_case_methods false, level: :error - style.allow_conditional_parentheses false, level: :warn - style.allow_hard_tabs false, level: :error - style.allow_screaming_snake_case_classes false, level: :error - style.allow_trailing_line_spaces false, level: :error - style.allow_unnecessary_interpolation false, level: :warn - style.allow_unnecessary_double_quotes false, level: :warn - style.allow_invalid_ruby false, level: :warn - style.indentation_spaces 2, level: :error - style.max_code_lines_in_class 300, level: :error - style.max_code_lines_in_method 30, level: :error - style.max_line_length 135, level: :error - style.spaces_after_comma 1, level: :error - style.spaces_after_conditional 1, level: :error - style.spaces_after_lbrace 1, level: :error - style.spaces_after_lbracket 0, level: :error - style.spaces_after_lparen 0, level: :error - style.spaces_before_comma 0, level: :error - style.spaces_before_lbrace 1, level: :error - style.spaces_before_rbrace 1, level: :error - style.spaces_before_rbracket 0, level: :error - style.spaces_before_rparen 0, level: :error - style.spaces_in_empty_braces 0, level: :error - style.trailing_newlines 1, level: :error - end -end From 7eea3b30600566b3693c8abbe1e571e6e622d24f Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:46:59 -0700 Subject: [PATCH 252/311] I am not sure they still want notified on travis testing going forward --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d75923d..df1b9b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,6 @@ script: notifications: email: recipients: - - leonard.tavae@gmail.com - - sysadmin@informatique.gov.pf - ian.smith@pnnl.gov on_success: always webhooks: From 4ebf98ea0a7a9a4087e43fdd514aefd9a1ce02b1 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:47:23 -0700 Subject: [PATCH 253/311] not using thor in testing that I am aware of --- Thorfile | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 Thorfile diff --git a/Thorfile b/Thorfile deleted file mode 100644 index 19aaaf2..0000000 --- a/Thorfile +++ /dev/null @@ -1,12 +0,0 @@ -# encoding: utf-8 - -require 'bundler' -require 'bundler/setup' -require 'berkshelf/thor' - -begin - require 'kitchen/thor_tasks' - Kitchen::ThorTasks.new -rescue LoadError - puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI'] -end From 0ae7811f9497a805d70bdfa7e376d08b9c6f9bb6 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:47:54 -0700 Subject: [PATCH 254/311] Useless file, already deleted in another branch as well.. --- .../serverspec/spec/spec_helper.rb | 89 ------------------- 1 file changed, 89 deletions(-) delete mode 100644 test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb diff --git a/test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb b/test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb deleted file mode 100644 index 3c0aae9..0000000 --- a/test/integration/bareos-aio-server/serverspec/spec/spec_helper.rb +++ /dev/null @@ -1,89 +0,0 @@ -# This file was generated by the `rspec --init` command. Conventionally, all -# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. -# The generated `.rspec` file contains `--require spec_helper` which will cause this -# file to always be loaded, without a need to explicitly require it in any files. -# -# Given that it is always loaded, you are encouraged to keep this file as -# light-weight as possible. Requiring heavyweight dependencies from this file -# will add to the boot time of your test suite on EVERY test run, even for an -# individual file that may not need all of that loaded. Instead, consider making -# a separate helper file that requires the additional dependencies and performs -# the additional setup, and require it from the spec files that actually need it. -# -# The `.rspec` file also contains a few flags that are not defaults but that -# users commonly want. -# -# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration -RSpec.configure do |config| - # rspec-expectations config goes here. You can use an alternate - # assertion/expectation library such as wrong or the stdlib/minitest - # assertions if you prefer. - config.expect_with :rspec do |expectations| - # This option will default to `true` in RSpec 4. It makes the `description` - # and `failure_message` of custom matchers include text for helper methods - # defined using `chain`, e.g.: - # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" - # ...rather than: - # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true - end - - # rspec-mocks config goes here. You can use an alternate test double - # library (such as bogus or mocha) by changing the `mock_with` option here. - config.mock_with :rspec do |mocks| - # Prevents you from mocking or stubbing a method that does not exist on - # a real object. This is generally recommended, and will default to - # `true` in RSpec 4. - mocks.verify_partial_doubles = true - end - - # The settings below are suggested to provide a good initial experience - # with RSpec, but feel free to customize to your heart's content. - begin - # These two settings work together to allow you to limit a spec run - # to individual examples or groups you care about by tagging them with - # `:focus` metadata. When nothing is tagged with `:focus`, all examples - # get run. - config.filter_run :focus - config.run_all_when_everything_filtered = true - - # Limits the available syntax to the non-monkey patched syntax that is recommended. - # For more details, see: - # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax - # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ - # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching - config.disable_monkey_patching! - - # This setting enables warnings. It's recommended, but in some cases may - # be too noisy due to issues in dependencies. - config.warnings = true - - # Many RSpec users commonly either run the entire suite or an individual - # file, and it's useful to allow more verbose output when running an - # individual spec file. - if config.files_to_run.one? - # Use the documentation formatter for detailed output, - # unless a formatter has already been configured - # (e.g. via a command-line flag). - config.default_formatter = 'doc' - end - - # Print the 10 slowest examples and example groups at the - # end of the spec run, to help surface which specs are running - # particularly slow. - config.profile_examples = 10 - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = :random - - # Seed global randomization in this process using the `--seed` CLI option. - # Setting this allows you to use `--seed` to deterministically reproduce - # test failures related to randomization by passing the same `--seed` value - # as the one that triggered the failure. - Kernel.srand config.seed - end -end From 5ad1a052cceb191dc4137f67b1f234298ad6bf43 Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:49:48 -0700 Subject: [PATCH 255/311] Attribute file cleanup * adding some test jobs to kitchen integration test * relabeling default/example section descriptors --- attributes/default.rb | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 6aecd89..7b302ef 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -119,7 +119,7 @@ # Examples - Default Hashes # ############################## -# General Client Config +# Default Client Config default['bareos']['clients']['conf'] = { 'FDPort' => '9102', 'File Retention' => '30 days', @@ -128,22 +128,9 @@ 'Maximum Concurrent Jobs' => '20' } -# Jobs - Example -# default['bareos']['clients']['jobs']["# #{node.default['bareos']['clients']['name']}-job"] = { -# '# Client' => "#{node['bareos']['clients']['name']}-fd", -# '# Type' => 'Backup', -# '# JobDefs' => 'default-def' -# } -# -# default['bareos']['clients']['jobs']["# #{node.default['bareos']['clients']['name']}-restore-job"] = { -# '# Client' => "#{node['bareos']['clients']['name']}-fd", -# '# Type' => 'Restore', -# '# JobDefs' => 'default-restore-def' -# } - default['bareos']['director']['jobs'] = nil -# Job Definitions +# Default Job Definitions default['bareos']['clients']['job_definitions']['default-def'] = { 'Level' => 'Incremental', 'Fileset' => 'default-fileset', @@ -175,7 +162,7 @@ 'Where' => '/tmp/bareos-restores' } -# Filesets +# Default Filesets default['bareos']['clients']['filesets']['default'] = { 'options' => { 'signature' => 'MD5' @@ -199,7 +186,7 @@ } } -# Pools +# Default Pools default['bareos']['clients']['pools']['default-file-pool'] = { 'Pool Type' => 'Backup', 'Recycle' => 'yes', @@ -209,7 +196,7 @@ 'LabelFormat' => 'FileVolume-' } -# Schedules +# Default Schedules default['bareos']['clients']['schedules']['monthly'] = { 'Description' => [ 'Default Monthly Schedule' @@ -224,14 +211,14 @@ ] } -# Storages +# Default Storages default['bareos']['clients']['storages']['default-file-storage'] = { 'Address' => node['bareos']['storage']['name'], # N.B. Use a fully qualified name here 'Device' => 'FileStorage', 'Media Type' => 'File' } -# Developing Feature - Tape Autochanger Devices +# Example/Test Tape Autochanger Configurations if node['bareos']['test_mode'] == true && node['bareos']['storage']['autochanger_enabled'] == true default['bareos']['storage']['autochangers']['autochanger-0'] = { 'Device' => [ @@ -270,11 +257,23 @@ 'MaximumFileSize' => '10GB' } - # Unmanaged client for testing + # Example Unmanaged client for testing default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { 'Address' => 'unmanaged-client', 'Password' => 'onefbofnerwob', 'Catalog' => 'MyCatalog', 'FDPort' => '9102' } + # Example Jobs + default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Backup', + 'JobDefs' => 'default-def' + } + + default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Restore', + 'JobDefs' => 'default-restore-def' + } end From 098780550b586d5d143e88b9bf3c0bda88f6de3f Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:52:17 -0700 Subject: [PATCH 256/311] Metadata updates * Adding some pessimistic cookbook dependency locks * Version bump for cleanup and minor bug fixes --- metadata.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.rb b/metadata.rb index 2383fc4..9737578 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.15' +version '2.2.16' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -14,8 +14,8 @@ supports os end -depends 'apt' -depends 'openssl' -depends 'postgresql', '< 4.0.0' -depends 'yum' -depends 'yum-epel' +depends 'apt', '~> 3.0.0' +depends 'openssl', '~> 4.4.0' +depends 'postgresql', '~> 3.4.24' +depends 'yum', '~> 3.10.0' +depends 'yum-epel', '~> 0.6.6' From a8a6f59ca17c4ed07480b14a6678579c7e77ba4a Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 16:54:09 -0700 Subject: [PATCH 257/311] Updating the autochanger template for readibility --- .../device-tape-with-autoloader.conf.erb | 75 +++++++++++-------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/templates/default/device-tape-with-autoloader.conf.erb b/templates/default/device-tape-with-autoloader.conf.erb index f6799ab..1e7cbdc 100644 --- a/templates/default/device-tape-with-autoloader.conf.erb +++ b/templates/default/device-tape-with-autoloader.conf.erb @@ -4,37 +4,52 @@ # # Bareos Autochanger Definition File -# Preparations: -# -# include this configuration file in bareos-sd.conf by -# @/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf -# +## Default commented lines from packaged config + +### Preparations + + +#### Include this configuration file in bareos-sd.conf by: + +#@/etc/bareos/bareos-sd.d/device-tape-with-autoloader.conf + + +#### On Linux use "lsscsi --generic" +#### to get a list of your SCSI devices. +#### However, normaly you should access your devices by-id +#### (eg. /dev/tape/by-id/scsi-350011d00018a5f03-nst), +#### because the short device names like /dev/nst1 +#### might change on reboot. + +#DriveIndex = 0 #default:0, only required if the autoloader have multiple drives. + + +#### If only one drive is available, this is normally /dev/nst0. +#### However, it is advised to access it via id (/dev/tape/by-id/...) + +#ArchiveDevice = /dev/nst0 +#ArchiveDevice = /dev/tape/by-id/scsi-350011d00018a5f03-nst + + +#### Arbitrary string that descripes the the storage media. + +#Description = "Some description for device" + + +#### Bareos uses this to determine which device can handle what media. + +#MediaType = lto + + +#### Enable "Check Labels" if tapes with ANSI/IBM labels should be preserved + +#Check Labels = yes +#AutoChanger = yes # default: no +#AutomaticMount = y # default: no +#MaximumFileSize = 10GB # default: 1000000000 (1GB) + -# on Linux use "lsscsi --generic" -# to get a list of your SCSI devices. -# However, normaly you should access your devices by-id -# (eg. /dev/tape/by-id/scsi-350011d00018a5f03-nst), -# because the short device names like /dev/nst1 -# might change on reboot. - -#### Other Default comment lines from default config #### -# DriveIndex = 0 #default:0, only required if the autoloader have multiple drives. - -# if only one drive is available, this is normally /dev/nst0. - # However, it is advised to access it via id (/dev/tape/by-id/...) - #ArchiveDevice = /dev/nst0 - #ArchiveDevice = /dev/tape/by-id/scsi-350011d00018a5f03-nst - # arbitrary string that descripes the the storage media. - # Bareos uses this to determine, which device can be handle what media. - -# enable "Check Labels" if tapes with ANSI/IBM labels - # should be preserved - #Check Labels = yes - -#AutoChanger = yes # default: no - #AutomaticMount = yes # default: no - #MaximumFileSize = 10GB # default: 1000000000 (1GB) -#### +######################################################### <%# AutoChanger Config %> <% @autochangers.sort.each do |autochanger_key, line_value1| %> From 80d6f0b9efe97aa2b089f99f7b417f0b3ae20dae Mon Sep 17 00:00:00 2001 From: I Smith Date: Mon, 11 Apr 2016 17:03:21 -0700 Subject: [PATCH 258/311] moving the .rspec file to top dir of cookbook for ease of use --- test/integration/bareos-aio-server/serverspec/.rspec => .rspec | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/integration/bareos-aio-server/serverspec/.rspec => .rspec (100%) diff --git a/test/integration/bareos-aio-server/serverspec/.rspec b/.rspec similarity index 100% rename from test/integration/bareos-aio-server/serverspec/.rspec rename to .rspec From e105282460742a51ffcb3305f6083d592012984d Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 12 Apr 2016 09:41:14 -0700 Subject: [PATCH 259/311] updating rubocop config --- .rubocop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cf64b45..37f17e1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,7 +16,7 @@ NumericLiterals: Enabled: false SpaceBeforeFirstArg: Enabled: false -Metrics/LineLength: +LineLength: Max: 180 -Style/FileName: +FileName: Enabled: false From 22ec0650f8858e8bdc2a8655ba2bd2fbca2a4ee4 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 12 Apr 2016 09:41:41 -0700 Subject: [PATCH 260/311] giving a simpler message to indicate what configs work.. --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 7b302ef..0b91175 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -93,7 +93,7 @@ default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 default['bareos']['storage']['autochanger_enabled'] = false -default['bareos']['storage']['conf']['help']['Example Block'] = '# Put any extra configs you would like to include in the storage daemon config below this line. Chef manages this file so make sure you are using the attributes to apply them.' +default['bareos']['storage']['conf']['help']['Example Block'] = '# You can put extra configs here.' # Director default['bareos']['director']['name'] = node['fqdn'] @@ -105,7 +105,7 @@ default['bareos']['director']['console_commandacl'] = 'status, .status' default['bareos']['director']['heartbeat_interval'] = 600 default['bareos']['director']['catalog_jobdef'] = 'default-catalog-def' -default['bareos']['director']['conf']['help']['Example Block'] = '# Put any extra configs you would like to include in the director config below this line. Chef manages this file so make sure you are using the attributes to apply them.' +default['bareos']['director']['conf']['help']['Example Block'] = '# You can put extra configs here.' default['bareos']['director']['config_change_notify'] = 'restart' # Subscription Management (Director) From 983d7439c29ae6199e4d04e23ccb8e15a3206001 Mon Sep 17 00:00:00 2001 From: I Smith Date: Thu, 14 Apr 2016 09:44:09 -0700 Subject: [PATCH 261/311] Found some potential dependency issues, making requirements more relaxed but pessimistically. --- metadata.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.rb b/metadata.rb index 9737578..56afe28 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.16' +version '2.2.17' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -14,8 +14,8 @@ supports os end -depends 'apt', '~> 3.0.0' -depends 'openssl', '~> 4.4.0' -depends 'postgresql', '~> 3.4.24' -depends 'yum', '~> 3.10.0' -depends 'yum-epel', '~> 0.6.6' +depends 'apt', '~> 3.0' +depends 'openssl', '~> 4.0' +depends 'postgresql', '~> 3.4' +depends 'yum', '~> 3.0' +depends 'yum-epel', '~> 0.6' From 2350d3c181b23bff953336f9aad169833f04f217 Mon Sep 17 00:00:00 2001 From: I Smith Date: Thu, 14 Apr 2016 15:24:51 -0700 Subject: [PATCH 262/311] Higher than 2.0 should be ok, patch bump for now.. --- metadata.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.rb b/metadata.rb index 56afe28..253b2dd 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.17' +version '2.2.18' %w( centos redhat ).each do |os| supports os, '>= 6.0' @@ -14,7 +14,7 @@ supports os end -depends 'apt', '~> 3.0' +depends 'apt', '>= 2.0' depends 'openssl', '~> 4.0' depends 'postgresql', '~> 3.4' depends 'yum', '~> 3.0' From 7d30389d630d7ce86dd53e6a855ab0ec3a537c77 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:18:15 -0700 Subject: [PATCH 263/311] Updating test suite to newest chef-client --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index d0ed2af..2032f80 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -4,7 +4,7 @@ driver: provisioner: name: chef_zero - require_chef_omnibus: 12.6.0 + require_chef_omnibus: 12.9.41 platforms: - name: debian-7.8 From be3b126a887e1c18c218ed70b12bf098db262338 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:19:22 -0700 Subject: [PATCH 264/311] Removing tests for outdated 12.04 Ubuntu, Removing Fedora Tests --- .kitchen.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 2032f80..fbf70d4 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -10,9 +10,6 @@ platforms: - name: debian-7.8 run_list: - recipe[apt] - - name: ubuntu-12.04 - run_list: - - recipe[apt] - name: ubuntu-14.04 run_list: - recipe[apt] @@ -22,12 +19,6 @@ platforms: - name: centos-7.2 run_list: - recipe[yum-epel] - - name: fedora-21 - run_list: - - recipe[yum-epel] - - name: fedora-22 - run_list: - - recipe[yum-epel] roles_path: test/integration/roles/ From cfcf780454ade450e233f289c762d6ece3f0a3db Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:19:54 -0700 Subject: [PATCH 265/311] There is already another config line that specifies LineLength cop, redundant --- .rubocop.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 37f17e1..ad89575 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,7 +16,5 @@ NumericLiterals: Enabled: false SpaceBeforeFirstArg: Enabled: false -LineLength: - Max: 180 FileName: Enabled: false From 0b3fcd97cae253edef489597e701c5739f2bd9ad Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:20:48 -0700 Subject: [PATCH 266/311] Updating the travis tests to test against latest stable ruby versions --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index df1b9b1..3479bd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: ruby rvm: - - 2.0.0 - - 2.1.5 - - 2.2.0 + - 2.1.9 + - 2.2.5 + - 2.3.1 script: - bundle exec rspec --color --format progress From a88d55d7862b4de3f3e27ef313881fe182d473de Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:21:36 -0700 Subject: [PATCH 267/311] Removing foodcritic test limitations, should be testing against all of it at this point. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3479bd5..4da5565 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ rvm: script: - bundle exec rspec --color --format progress - - bundle exec foodcritic -f any --tags ~FC003 --tags ~FC015 --tags ~FC023 . + - bundle exec foodcritic -f any . - bundle exec rubocop notifications: From 736ee2f01d5da445ed52aa6f557e4b4a8abe1d81 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:22:44 -0700 Subject: [PATCH 268/311] Adding back the original maintainer email addresses, was temporary --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4da5565..3e6b4b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ script: notifications: email: recipients: + - leonard.tavae@gmail.com + - sysadmin@informatique.gov.pf - ian.smith@pnnl.gov on_success: always webhooks: From 9047a5f3f8c394d9a1bfd93a6f9db59c81b2af9b Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:27:52 -0700 Subject: [PATCH 269/311] Cleanup --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c27387f..266a678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ -Bareos Cookbook CHANGELOG -========================== - -This file is used to list changes made in each version of the bareos cookbook. +CHANGELOG +========= +Chef-Bareos Cookbook +-------------------- 2.2.13 ------ +------ - Ian Smith - Near complete refactoring of how the cookbook works From 45dcaec6848104bb59ed509dac8371a496c914c9 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:28:08 -0700 Subject: [PATCH 270/311] I don't think we need this in here anymore.. --- Gemfile | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Gemfile b/Gemfile index 35a481d..375cf4f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,6 @@ source 'https://rubygems.org' gem 'berkshelf' - -# Uncomment these lines if you want to live on the Edge: -# -# group :development do -# gem "berkshelf", github: "berkshelf/berkshelf" -# gem "vagrant", github: "mitchellh/vagrant", tag: "v1.6.3" -# end -# -# group :plugins do -# gem "vagrant-berkshelf", github: "berkshelf/vagrant-berkshelf" -# gem "vagrant-omnibus", github: "schisamo/vagrant-omnibus" -# end - gem 'test-kitchen' gem 'kitchen-vagrant' gem 'rubocop' From a3029cd354ede813575009c0ba80d23aada20eee Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 11:34:19 -0700 Subject: [PATCH 271/311] Trying to address the missing line I am seeing, may not be any actual changes here.. --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 2747fa8..18246d6 100644 --- a/LICENSE +++ b/LICENSE @@ -10,4 +10,4 @@ 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. \ No newline at end of file +limitations under the License. From c13c469a323fdfeb5362b743bf0748064637e836 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:46:47 -0700 Subject: [PATCH 272/311] Adding a new graphite feature and moving to version 4.0+ for postgresql cookbook --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 253b2dd..33e0348 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures bareos' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.2.18' +version '3.0.1' %w( centos redhat ).each do |os| supports os, '>= 6.0' From 96b3cf169f59bc97d74ddea970de3f62109f6c5f Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:47:12 -0700 Subject: [PATCH 273/311] General Cleanup --- metadata.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.rb b/metadata.rb index 33e0348..b663691 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,9 +1,9 @@ -name 'chef-bareos' -maintainer 'dsi' -maintainer_email 'leonard.tavae@informatique.gov.pf' -license 'Apache 2.0' -description 'Installs/Configures bareos' -long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +name 'chef-bareos' +maintainer 'dsi' +maintainer_email 'leonard.tavae@informatique.gov.pf' +license 'Apache 2.0' +description 'Installs/Configures BAREOS - Backup Archiving REcovery Open Sourced' +long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '3.0.1' %w( centos redhat ).each do |os| From 12049f7aa00943521882d82b99016119f13b2a0f Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:47:31 -0700 Subject: [PATCH 274/311] Removing support for Fedora --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index b663691..5332028 100644 --- a/metadata.rb +++ b/metadata.rb @@ -10,7 +10,7 @@ supports os, '>= 6.0' end -%w( fedora debian ubuntu ).each do |os| +%w( debian ubuntu ).each do |os| supports os end From da89f0c4fd37af680c57bb29083e9d901ca5296a Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:48:12 -0700 Subject: [PATCH 275/311] Moving up dependency locks --- metadata.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/metadata.rb b/metadata.rb index 5332028..0761d64 100644 --- a/metadata.rb +++ b/metadata.rb @@ -15,7 +15,6 @@ end depends 'apt', '>= 2.0' -depends 'openssl', '~> 4.0' -depends 'postgresql', '~> 3.4' -depends 'yum', '~> 3.0' -depends 'yum-epel', '~> 0.6' +depends 'openssl', '>= 4.0' +depends 'postgresql', '~> 4.0' +depends 'yum-epel', '>= 0.6' From d7e90ff8be8e6f3027783d49936c04f08e12dae6 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:53:37 -0700 Subject: [PATCH 276/311] Cleanup clutter --- attributes/default.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 0b91175..894ab0b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,10 +1,7 @@ # Repository - default['bareos']['url'] = 'http://download.bareos.org/bareos/release' default['bareos']['contrib_url'] = 'http://download.bareos.org/bareos/contrib' -# Used to have 'latest' as default, had potential update dangers -# default['bareos']['version'] = 'latest' <--- Could be dangerous, ***CAUTION*** default['bareos']['version'] = '15.2' # <--- Latest Stable version as of 06-Dec-2015 if platform_family?('rhel', 'fedora') From ec31ab521612dd62b8cef0e2a30412374c4a8dfb Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:54:12 -0700 Subject: [PATCH 277/311] Seemed better to generalize this for use in other places than just the yum repo.. --- attributes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 894ab0b..d080afa 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -5,9 +5,9 @@ default['bareos']['version'] = '15.2' # <--- Latest Stable version as of 06-Dec-2015 if platform_family?('rhel', 'fedora') - default['bareos']['yum_repository'] = 'bareos' + default['bareos']['repository_name'] = 'bareos' default['bareos']['description'] = "Backup Archiving REcovery Open Sourced Current #{node['bareos']['version']}" - default['bareos']['contrib_yum_repository'] = 'bareos_contrib' + default['bareos']['contrib_repository_name'] = 'bareos_contrib' default['bareos']['contrib_description'] = "Backup Archiving REcovery Open Sourced Current #{node['bareos']['version']} contrib" end From 73974035b1f8d48298a4dec5f7ea1ba2b06a723d Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:54:41 -0700 Subject: [PATCH 278/311] Adding new bits for the graphite plugin recipe --- attributes/default.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/attributes/default.rb b/attributes/default.rb index d080afa..ea69dce 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -112,6 +112,21 @@ # Workstation default['bareos']['workstation']['name'] = node['fqdn'] +# Graphite Plugin Default Attributes +default['bareos']['plugins']['graphite']['packages'] = if platform_family?('rhel') && node['platform_version'].to_i == 6 + %w(python python-bareos python-requests python-fedora-django) + else + %w(python python-bareos python-requests python-django) + end + +default['bareos']['plugins']['graphite']['plugin_path'] = '/usr/sbin' +default['bareos']['plugins']['graphite']['config_path'] = '/etc/bareos' +default['bareos']['plugins']['graphite']['search_query'] = 'roles:bareos_director' +default['bareos']['plugins']['graphite']['server'] = 'graphite' +default['bareos']['plugins']['graphite']['graphite_port'] = '2003' +default['bareos']['plugins']['graphite']['graphite_data_prefix'] = 'bareos.' +default['bareos']['plugins']['graphite']['graphite_plugin_src_url'] = 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py' + ############################## # Examples - Default Hashes # ############################## From fca5cf2b0e63e8398af551b3842f01a48c230476 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:55:22 -0700 Subject: [PATCH 279/311] Header cleanup and name correction per LICENSE file --- recipes/autochanger.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/autochanger.rb b/recipes/autochanger.rb index fa3ff7d..dfedff8 100644 --- a/recipes/autochanger.rb +++ b/recipes/autochanger.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: autochanger # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: autochanger # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From 2f3c57f4a6e861b71594abdaf275e3a6f2c84f9a Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:55:46 -0700 Subject: [PATCH 280/311] Header cleanup, name correction per LICENSE file --- recipes/client.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/client.rb b/recipes/client.rb index a84c52d..a27ab4b 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: client # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: client # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From fe094c4ae514d06f0392da609f01a0064029f5a8 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:56:18 -0700 Subject: [PATCH 281/311] Adding sensitive due to passwords being put into files --- recipes/client.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/client.rb b/recipes/client.rb index a27ab4b..35d6689 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -44,6 +44,7 @@ variables( bareos_dir: bareos_dir ) + sensitive true end # Allow the restart of the File Daemon with tests upfront, if called From 633db0327ef2987bb9aa61b39f9db477174bbaa3 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:56:47 -0700 Subject: [PATCH 282/311] Starting the service along with enabling it seems like a basic thing here.. --- recipes/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/client.rb b/recipes/client.rb index 35d6689..4690310 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -58,5 +58,5 @@ # Start and enable the BAREOS File Daemon service 'bareos-fd' do supports status: true, restart: true, reload: false - action :enable + action [:enable, :start] end From c1bee477fbd75ddbee5be379c14a5381e00ffb9c Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:57:57 -0700 Subject: [PATCH 283/311] Header cleanup, name correction per LICENSE file. --- recipes/database.rb | 7 ++++--- recipes/default.rb | 7 ++++--- recipes/repo.rb | 7 ++++--- recipes/server.rb | 7 ++++--- recipes/storage.rb | 7 ++++--- recipes/workstation.rb | 7 ++++--- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/recipes/database.rb b/recipes/database.rb index 3d5ae7c..686d167 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: database # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: database # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/default.rb b/recipes/default.rb index 53f0723..c9f90a0 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: default # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: default # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/repo.rb b/recipes/repo.rb index dec2fba..e737ad7 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: repo # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: repo # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/server.rb b/recipes/server.rb index 531a6fc..af435aa 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: server # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: server # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/storage.rb b/recipes/storage.rb index e97165a..8fa6590 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: storage # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: storage # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 04acbed..1e57919 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -1,8 +1,9 @@ # encoding: UTF-8 -# Cookbook Name:: bareos -# Recipe:: workstation # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2014 Léonard TAVAE +# +# Cookbook Name:: chef-bareos +# Recipe:: workstation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. From c66a6f0875a9b0ec0438b82fedce5f42cf27ac2e Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 13:59:56 -0700 Subject: [PATCH 284/311] Adding new graphite plugin recipe: * Adds recipe to install plugin related bits * Includes a template to auto-populate fields based on attributes --- recipes/graphite_plugin.rb | 48 ++++++++++++++++++++++ templates/default/graphite-poller.conf.erb | 10 +++++ 2 files changed, 58 insertions(+) create mode 100644 recipes/graphite_plugin.rb create mode 100644 templates/default/graphite-poller.conf.erb diff --git a/recipes/graphite_plugin.rb b/recipes/graphite_plugin.rb new file mode 100644 index 0000000..8959673 --- /dev/null +++ b/recipes/graphite_plugin.rb @@ -0,0 +1,48 @@ +# encoding: UTF-8 +# +# Cookbook Name:: chef-bareos +# Recipe:: graphite_plugin +# +# 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. + +include_recipe 'chef-bareos::repo' + +node['bareos']['plugins']['graphite']['packages'].each do |py_pkg| + package py_pkg +end + +directory node['bareos']['plugins']['graphite']['config_path'] + +template "#{node['bareos']['plugins']['graphite']['config_path']}/graphite-poller.conf" do + owner 'root' + group 'root' + mode '0740' + sensitive true +end + +remote_file "#{node['bareos']['plugins']['graphite']['plugin_path']}/bareos-graphite-poller.py" do + source node['bareos']['plugins']['graphite']['graphite_plugin_src_url'] + owner 'root' + group 'root' + mode '0740' + use_last_modified true + use_conditional_get true + sensitive true +end + +cron 'bareos_graphite_poller' do + command <<-EOH + #{node['bareos']['plugins']['graphite']['plugin_path']}/bareos-graphite-poller.py\ + -c #{node['bareos']['plugins']['graphite']['config_path']}/graphite-poller.conf + EOH +end diff --git a/templates/default/graphite-poller.conf.erb b/templates/default/graphite-poller.conf.erb new file mode 100644 index 0000000..099c745 --- /dev/null +++ b/templates/default/graphite-poller.conf.erb @@ -0,0 +1,10 @@ +<%# BAREOS GRAPHITE PLUGIN CONFIGURATION TEMPLATE %> +[director] +server=<%= node['bareos']['director']['net_name'] %> +name=<%= node['bareos']['director']['name'] %>-dir +password=<%= node['bareos']['dir_password'] %> + +[graphite] +server=<%= node['bareos']['plugins']['graphite']['server'] %> +port=<%= node['bareos']['plugins']['graphite']['graphite_port'] %> +prefix=<%= node['bareos']['plugins']['graphite']['graphite_data_prefix'] %> From b0d30d9982e22a7bf9ae7962a4bf7517087778b8 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:00:39 -0700 Subject: [PATCH 285/311] Change to the generic naming attribute for these entries so not yum specific --- recipes/repo.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/repo.rb b/recipes/repo.rb index e737ad7..502ef45 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -20,13 +20,13 @@ # Add repos for supported OS platforms, otherwise return fatal notice case node['platform_family'] when 'rhel', 'fedora' - yum_repository node['bareos']['yum_repository'] do + yum_repository node['bareos']['repository_name'] do description node['bareos']['description'] baseurl node['bareos']['baseurl'] gpgkey node['bareos']['gpgkey'] action :create end - yum_repository node['bareos']['contrib_yum_repository'] do + yum_repository node['bareos']['contrib_repository_name'] do description node['bareos']['contrib_description'] baseurl node['bareos']['contrib_baseurl'] gpgkey node['bareos']['contrib_gpgkey'] From adafb42d4ba3dc537335eb660ad92e56e7cdad54 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:02:35 -0700 Subject: [PATCH 286/311] Bareos repos not compliant with distribution version naming * Newest versions of apt cookbook trying to force add a distribution string (i.e. wheezy), this nullifies that issue. --- recipes/repo.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/repo.rb b/recipes/repo.rb index 502ef45..911c07f 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -36,11 +36,13 @@ apt_repository 'bareos' do uri node['bareos']['baseurl'] components ['/'] + distribution '' key node['bareos']['gpgkey'] end apt_repository 'bareos_contrib' do uri node['bareos']['contrib_baseurl'] components ['/'] + distribution '' key node['bareos']['contrib_gpgkey'] end else From 7129ee10a8dcb733d7a68f5fb166fbbed8696a24 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:04:16 -0700 Subject: [PATCH 287/311] Try to make chef run less noisy, protects from password leaks. --- recipes/server.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/recipes/server.rb b/recipes/server.rb index af435aa..6ea4d18 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -49,6 +49,7 @@ variables( dir_help: node['bareos']['director']['conf']['help'] ) + sensitive true action :create end @@ -66,6 +67,7 @@ db_address: node['bareos']['database']['dbaddress'], dir_name: node['bareos']['director']['name'] ) + sensitive true only_if { File.exist?('/etc/bareos/bareos-dir.d/dir_helper.conf') } end @@ -88,6 +90,7 @@ bareos_clients: bareos_clients, client_conf: node['bareos']['clients']['conf'] ) + sensitive true end # Create other various configs based on sets of hashes @@ -99,6 +102,7 @@ variables( jobs: node['bareos']['clients']['jobs'] ) + sensitive true end template '/etc/bareos/bareos-dir.d/job_definitions.conf' do source 'job_definitions.conf.erb' @@ -108,6 +112,7 @@ variables( job_definitions: node['bareos']['clients']['job_definitions'] ) + sensitive true end template '/etc/bareos/bareos-dir.d/filesets.conf' do source 'filesets.conf.erb' @@ -117,6 +122,7 @@ variables( fileset_config: node['bareos']['clients']['filesets'] ) + sensitive true end template '/etc/bareos/bareos-dir.d/pools.conf' do source 'pools.conf.erb' @@ -126,6 +132,7 @@ variables( client_pools: node['bareos']['clients']['pools'] ) + sensitive true end template '/etc/bareos/bareos-dir.d/schedules.conf' do source 'schedules.conf.erb' @@ -135,6 +142,7 @@ variables( client_schedules: node['bareos']['clients']['schedules'] ) + sensitive true end template '/etc/bareos/bareos-dir.d/storages.conf' do source 'storages.conf.erb' @@ -144,6 +152,7 @@ variables( client_storages: node['bareos']['clients']['storages'] ) + sensitive true end # Allow a reload of the director daemon configs if called with tests up front From 9ee009d227a05393f94d9d10acfc969660616fdb Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:05:13 -0700 Subject: [PATCH 288/311] bareos-dir service needs to be started before reload happens otherwise things hang. --- recipes/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/server.rb b/recipes/server.rb index 6ea4d18..b538c6b 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -170,7 +170,7 @@ if node['bareos']['director']['config_change_notify'] == 'restart' notifies :restart, 'service[bareos-dir]', :delayed else - notifies :start, 'service[bareos-dir]' + notifies :start, 'service[bareos-dir]', :immediate notifies :run, 'execute[bareos-dir_reload]', :delayed end end From 15395f882b106f2ce93719a8a76873dacda5974a Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:05:48 -0700 Subject: [PATCH 289/311] Make sure to restart bareos-dir if postgresql makes a change or restarts --- recipes/server.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/server.rb b/recipes/server.rb index b538c6b..31c0946 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -178,7 +178,8 @@ # Enable and start the bareos-dir service service 'bareos-dir' do supports status: true, restart: true, reload: false - action :enable + action [:enable, :start] + subscribes :restart, 'service[postgresql]', :delayed end # Optional reload of the director config via execute From 007f479d8d2ec03eaa5dc3034877546481d41691 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:06:19 -0700 Subject: [PATCH 290/311] Make chef run less noisy, protect from chef log password leaks --- recipes/storage.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/storage.rb b/recipes/storage.rb index 8fa6590..ff807a0 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -56,6 +56,7 @@ variables( sd_help: node['bareos']['storage']['conf']['help'] ) + sensitive true action :create end @@ -69,6 +70,7 @@ bareos_sd: bareos_sd, bareos_dir: bareos_dir ) + sensitive true only_if { File.exist?('/etc/bareos/bareos-sd.d/sd_helper.conf') } end From b0a28fa0894288e45437a3dae0cd5b8f2b1e559b Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:06:38 -0700 Subject: [PATCH 291/311] Let's start the service as well as enable it. --- recipes/storage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/storage.rb b/recipes/storage.rb index ff807a0..ed27fec 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -88,5 +88,5 @@ # Start and enable SD service service 'bareos-sd' do supports status: true, restart: true, reload: false - action :enable + action [:enable, :start] end From d5638fc969bae446e8aac45d19f69cf728685ab0 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:06:59 -0700 Subject: [PATCH 292/311] chef less noisy, protect from chef log pass leak --- recipes/workstation.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 1e57919..b99843e 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -40,4 +40,5 @@ variables( bareos_dir: bareos_dir ) + sensitive true end From b2287dde5c5dced1d65f298318ae2e32989ffd07 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:07:17 -0700 Subject: [PATCH 293/311] Adding the graphite plugin to test suite. --- test/integration/roles/bareos_director.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/integration/roles/bareos_director.json b/test/integration/roles/bareos_director.json index 378b6f4..8d3d4ec 100644 --- a/test/integration/roles/bareos_director.json +++ b/test/integration/roles/bareos_director.json @@ -12,7 +12,8 @@ "recipe[chef-bareos::database]", "role[bareos_storage]", "recipe[chef-bareos::server]", - "recipe[chef-bareos::workstation]" + "recipe[chef-bareos::workstation]", + "recipe[chef-bareos::graphite_plugin]" ], "env_run_lists": { } From 9b574a8bd82401d2cc50616b3cdd7fab3452cc92 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 14:38:25 -0700 Subject: [PATCH 294/311] Cleanup, adding recipe descriptions, more to add soon hopefully. --- README.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 67be227..c6cca07 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ Chef-Bareos Cookbook ==================== -[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) +[![BuildStatus](https://travis-ci.org/sitle/chef-bareos.svg?branch=master)](https://travis-ci.org/sitle/chef-bareos) +[![Join the chat at https://gitter.im/EMSL-MSC/chef-bareos](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/EMSL-MSC/chef-bareos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) This cookbook installs and configures backups based on [BAREOS](https://www.bareos.org/en/). @@ -11,11 +12,10 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare ## Supported Platforms: - * Ubuntu 12.04+ - * Debian 7 + * Ubuntu 14.04 (plan to add 16.04 as soon as binary is released) + * Debian 7 (8+ may or may not work, you'll need a repo basically) * CentOS 6+ - * RHEL 6+ - * Fedora 21/22 + * RHEL 6+ (Assumed to work just as well as on CentOS) ## Supported Chef Versions: @@ -159,15 +159,25 @@ You'll need a searchable storage role named ```bareos_storage```, for example: ### Recipes #### default.rb +Installs necessary repos and includes the Bareos client recipe #### client.rb +Installs client packages and creates a config file that is linked to available directors on chef server. +You may also feed directors to the config via attributes if running in solo mode. #### repo.rb +Installs base Bareos repo as well as the Bareos Contrib repo. #### database.rb +Installs whichever database is desired per attributes (PostgreSQL/MySQL), installs Bareos database packages and creates the bareos database and user for you. Should also set the database password by default. You may need to recover this from the attributes or set a new one via vault via wrapper recipe. #### server.rb +Installs necessary Bareos server packages and sets up base configs necessary for server to start. Also creates the config directory (bareos-dir.d) so you can drop whatever outside config files into place and have them get automatically included in your setup. #### storage.rb +Installs necessary Bareos storage packages and sets up a default file storage for you to start backing stuff up to right away (configured for ~250GB of volumes by default). #### autochanger.rb +This bit will setup an autochanger based on a pretty straight forward has table. Tested with IBM TS3500 Tape Library with 10 Frames and 16 Tape drives. #### workstation.rb - -### Hashable Configurations (via templates) +Installs bconsole essentially. I plan to create another recipe for bat (Bareos Administration Tool) and the Bareos Web UI but I haven't gotten around to it yet. +#### graphite_plugin.rb +This was an exciting recent addition to the Bareos contrib GitHub repo. This addition in its current form will be dependent on a pending merge request getting accepted but if it isn't merged it can be easily worked around. Should work out of the gate here pretty soon given you adjust the graphite server string in the attributes for a graphite server location. +### Hashable Configurations for templates #### bconsole #### clients #### autochanger @@ -207,7 +217,7 @@ 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. -### Authors +### Authors * Léonard TAVAE * Ian Smith From a6c9426986acf4da32ae04eef854ad9ba6e73e1f Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:11:34 -0700 Subject: [PATCH 295/311] Quick fix to include some metadata fits I have been meaning to add * source_url * issues_url # Conflicts: # .kitchen.yml # README.md # attributes/default.rb # metadata.rb # recipes/repo.rb # recipes/server.rb # recipes/workstation.rb # templates/default/bareos-dir.conf.erb # templates/default/bareos-fd.conf.erb # templates/default/bareos-sd.conf.erb # templates/default/bconsole.conf.erb # templates/default/client.conf.erb --- metadata.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metadata.rb b/metadata.rb index 0761d64..89fe459 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,6 +4,8 @@ license 'Apache 2.0' description 'Installs/Configures BAREOS - Backup Archiving REcovery Open Sourced' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +issues_url 'https://github.com/sitle/chef-bareos/issues' +source_url 'https://github.com/sitle/chef-bareos.git' version '3.0.1' %w( centos redhat ).each do |os| From d133d938fd88cca23f39922a6a4484da2e8d5117 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:11:34 -0700 Subject: [PATCH 296/311] Quick fix to include some newer metadata bits * source_url * issues_url --- metadata.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metadata.rb b/metadata.rb index 0761d64..89fe459 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,6 +4,8 @@ license 'Apache 2.0' description 'Installs/Configures BAREOS - Backup Archiving REcovery Open Sourced' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) +issues_url 'https://github.com/sitle/chef-bareos/issues' +source_url 'https://github.com/sitle/chef-bareos.git' version '3.0.1' %w( centos redhat ).each do |os| From 56e4c86929303d455e61e4945a6863bbef2ee15d Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:20:58 -0700 Subject: [PATCH 297/311] Linters didn't like the non-ascii characters, cleaned that up --- CHANGELOG.md | 6 +++--- README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 266a678..4a324b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,7 @@ Chef-Bareos Cookbook 0.1.2 ----- -- Léonard TAVAE +- Leonard TAVAE - The License has changed (Apache 2.0) - The cookbook now passed foodcritic, rubocop and tailor with success @@ -78,10 +78,10 @@ Chef-Bareos Cookbook 0.1.1 ----- -- Léonard TAVAE - Major release +- Leonard TAVAE - Major release 0.1.0 ----- -- Léonard TAVAE - Initial release of bareos +- Leonard TAVAE - Initial release of bareos - - - diff --git a/README.md b/README.md index c6cca07..f846759 100644 --- a/README.md +++ b/README.md @@ -203,7 +203,7 @@ This was an exciting recent addition to the Bareos contrib GitHub repo. This add ### License -Copyright 2014 Léonard TAVAE +Copyright 2014 Leonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -219,6 +219,6 @@ limitations under the License. ### Authors -* Léonard TAVAE +* Leonard TAVAE * Ian Smith * Gerhard Sulzberger From 6cf60d1e6a35df131494579db0af1bf66739bf7d Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:23:50 -0700 Subject: [PATCH 298/311] Fix non-ascii characters for linters --- LICENSE | 2 +- recipes/autochanger.rb | 2 +- recipes/client.rb | 2 +- recipes/database.rb | 2 +- recipes/default.rb | 2 +- recipes/repo.rb | 2 +- recipes/server.rb | 2 +- recipes/storage.rb | 2 +- recipes/workstation.rb | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/LICENSE b/LICENSE index 18246d6..98c9d3e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2014 Léonard TAVAE +Copyright 2014 Leonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/recipes/autochanger.rb b/recipes/autochanger.rb index dfedff8..2510439 100644 --- a/recipes/autochanger.rb +++ b/recipes/autochanger.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: autochanger diff --git a/recipes/client.rb b/recipes/client.rb index 4690310..c42bf6e 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: client diff --git a/recipes/database.rb b/recipes/database.rb index 686d167..0d6359d 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: database diff --git a/recipes/default.rb b/recipes/default.rb index c9f90a0..c5d5551 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: default diff --git a/recipes/repo.rb b/recipes/repo.rb index 911c07f..5b04bf6 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: repo diff --git a/recipes/server.rb b/recipes/server.rb index 31c0946..008d319 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: server diff --git a/recipes/storage.rb b/recipes/storage.rb index ed27fec..902df52 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: storage diff --git a/recipes/workstation.rb b/recipes/workstation.rb index b99843e..652cae3 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Léonard TAVAE +# Copyright (C) 2014 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: workstation From 5dfacfcc911fe616694b6d8c603e5260928eabcd Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:24:22 -0700 Subject: [PATCH 299/311] haven't tested yet but linters picked up that these weren't used --- spec/unit/recipes/repo_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/unit/recipes/repo_spec.rb b/spec/unit/recipes/repo_spec.rb index 840a9f6..ea35ede 100644 --- a/spec/unit/recipes/repo_spec.rb +++ b/spec/unit/recipes/repo_spec.rb @@ -10,7 +10,7 @@ end let(:chef_run) do - ChefSpec::SoloRunner.new do |node| + ChefSpec::SoloRunner.new do end.converge('chef-bareos::repo') end @@ -35,7 +35,7 @@ end let(:chef_run) do - ChefSpec::SoloRunner.new do |node| + ChefSpec::SoloRunner.new do end.converge('chef-bareos::repo') end From 061599ec1390e4936a4724038f439f60372de32e Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:39:38 -0700 Subject: [PATCH 300/311] fixing chefspec tests for travisci --- spec/unit/recipes/default_spec.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index 0bf2355..4ab6cdd 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -27,15 +27,11 @@ chef_run end - # it 'includes the openssl recipe' do - # expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('openssl::default') - # chef_run - # end end - context 'on an ubuntu 12.04 box' do + context 'on an ubuntu 14.04 box' do let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') + runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04') runner.converge(described_recipe) end @@ -52,11 +48,9 @@ end end - context 'on an centos 6.6 box' do + context 'on an centos 6.7 box' do let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.6') do |node| - node.set['bareos']['yum_repository'] = 'bareos-repo-test' - node.set['bareos']['baseurl'] = 'http://foo/bar' + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.7') do |node| end runner.converge(described_recipe) end @@ -66,11 +60,11 @@ end it 'adds the yum repo bareos' do - expect(chef_run).to create_yum_repository('bareos-repo-test').with(baseurl: 'http://foo/bar') + expect(chef_run).to create_yum_repository('bareos') end it 'adds the yum repo bareos_contrib' do - expect(chef_run).to create_yum_repository('bareos_contrib').with(baseurl: 'http://download.bareos.org/bareos/contrib/CentOS_6/') + expect(chef_run).to create_yum_repository('bareos_contrib') end end end From 82149d8d92b2afa9af1df29baac07e188e64ee9c Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 15:44:47 -0700 Subject: [PATCH 301/311] minor fixes for travis again.. --- spec/unit/recipes/default_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/unit/recipes/default_spec.rb b/spec/unit/recipes/default_spec.rb index 4ab6cdd..7407482 100644 --- a/spec/unit/recipes/default_spec.rb +++ b/spec/unit/recipes/default_spec.rb @@ -26,7 +26,6 @@ expect_any_instance_of(Chef::Recipe).to receive(:include_recipe).with('chef-bareos::client') chef_run end - end context 'on an ubuntu 14.04 box' do @@ -50,7 +49,7 @@ context 'on an centos 6.7 box' do let(:chef_run) do - runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.7') do |node| + runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.7') do end runner.converge(described_recipe) end From f11493764717f48df4b6060ac69046832a86c8d8 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 16:14:39 -0700 Subject: [PATCH 302/311] attempting to fix travis ci rspec tests --- .travis.yml | 3 ++- Gemfile | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e6b4b1..1383ab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ rvm: - 2.3.1 script: - - bundle exec rspec --color --format progress + - bundle install + - bundle exec rspec --default-path spec - bundle exec foodcritic -f any . - bundle exec rubocop diff --git a/Gemfile b/Gemfile index 375cf4f..a57eeda 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,6 @@ gem 'test-kitchen' gem 'kitchen-vagrant' gem 'rubocop' gem 'foodcritic' -gem 'rspec' +gem 'chefspec' +gem 'rspec', '>= 3.4' +gem 'rake' From f74c1536435fd86acb2ac21c311193ef6658fb12 Mon Sep 17 00:00:00 2001 From: I Smith Date: Tue, 10 May 2016 16:18:28 -0700 Subject: [PATCH 303/311] removing redundant script action --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1383ab5..3435915 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ rvm: - 2.3.1 script: - - bundle install - bundle exec rspec --default-path spec - bundle exec foodcritic -f any . - bundle exec rubocop From cff1754f497600794db9bd869268c869ee7e5feb Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:37:10 -0700 Subject: [PATCH 304/311] Updating with a summarized update due to the number of changes --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a324b1..1f58c95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,21 @@ CHANGELOG Chef-Bareos Cookbook -------------------- +3.0.2 +----- +- Ian Smith + + - Complete re-work of cookbook, which includes the rework bits from version 2.0 + - Adding various features including: + * Templates populated from hash tables + * Up to date README + * Graphite plugin deployment recipe + * Migrate to postgresql cookbook version 4+ + * Better testing (rspec), testing against current ruby, need some more rspec tests but no time + * Various other updates and enhancements, see README for details + * Supermarket Release...finally + - ***NOTE*** This release adds functionality that is not backwards compatible. Version lock until you have time to test the migration to version 3.0+ + 2.2.13 ------ - Ian Smith From 8123dd3e3cb558811814070366452b601f155fa5 Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:37:26 -0700 Subject: [PATCH 305/311] Consistency --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 98c9d3e..93f28f3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2014 Leonard TAVAE +Copyright (C) 2016 Leonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 4a6ec9e8c7dae8de1c9de468ac9b0202af1a1027 Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:37:45 -0700 Subject: [PATCH 306/311] Minor update to version for README updates --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 89fe459..78a7075 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) issues_url 'https://github.com/sitle/chef-bareos/issues' source_url 'https://github.com/sitle/chef-bareos.git' -version '3.0.1' +version '3.0.2' %w( centos redhat ).each do |os| supports os, '>= 6.0' From eb50e4ee9196d898dba41eeea3ec3e5c6492fd07 Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:37:55 -0700 Subject: [PATCH 307/311] Updating README --- README.md | 412 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 320 insertions(+), 92 deletions(-) diff --git a/README.md b/README.md index f846759..c9646ee 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,7 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare [Official BAREOS Documentation](http://doc.bareos.org/master/html/bareos-manual-main-reference.html). -# Requirements - ## Supported Platforms: - * Ubuntu 14.04 (plan to add 16.04 as soon as binary is released) * Debian 7 (8+ may or may not work, you'll need a repo basically) * CentOS 6+ @@ -21,66 +18,149 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare * Chef 11+ -# Attributes +## Important Notable Attributes -## Repository +### Repository Assists with adding necessary sources for installing Bareos +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['url'] | 'http://download.bareos.org/bareos/release' | Main installation URL +['bareos']['contrib_url'] | 'http://download.bareos.org/bareos/contrib' | Main contrib installation URL +['bareos']['version'] | '15.2' | Default Bareos Version -Attribute | Description | Type | Default ------------------|-------------|------|--------- +For other platform specific attributes please see default attributes file for more detail. -## Messages +### Messages Defines default admin e-mail address for service notifications and what messages to care about -Attribute | Description | Type | Default ------------------|-------------|------|--------- +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['messages']['mail_to'] | "bareos@#{node['domain']}" | Default messages e-mail destination +['bareos']['messages']['default_messages'] | 'Standard' | Default client message capture level +['bareos']['messages']['default_admin_messages'] | 'all, !skipped, !restored' | Default server message capture level +### Database +Populates the Catalog resource in the main Director configuration + +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['database']['catalog_name'] | 'MyCatalog' | Default catalog name +['bareos']['database']['database_type'] | 'postgresql' | Default database installment indicator +['bareos']['database']['dbdriver'] | 'postgresql' | Config entry for type of database +['bareos']['database']['dbname'] | 'bareos' | Default database name +['bareos']['database']['dbuser'] | 'bareos' | Default database user +['bareos']['database']['dbpassword'] | *blank string* | Default gets generated by postgresql cookbook, unless specified here +['bareos']['database']['dbaddress'] | nil | This is often just the localhost, so this is only needed in certain cases + +### Clients +Provides resources for the Catalog (Director configuration) and Filedaemon configurations/templates -## Database -Prefills the Catalog resource in the main Director configuration +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['clients']['name'] | node['fqdn'] | Uses the node FQDN by default as prefix for filedaemon name +['bareos']['clients']['net_name'] | node['fqdn'] | DNS Network name used to resolve client +['bareos']['clients']['fd_port'] | 9102 | Default filedaemon port +['bareos']['clients']['max_concurrent_jobs'] | 20 | Default number of concurrent jobs +['bareos']['clients']['heartbeat_interval'] | 600 | Proven a useful default value, change as needed +['bareos']['clients']['client_search_query'] | 'roles:bareos_client' | Default search query to find Bareos clients +['bareos']['clients']['client_list'] | %w(node) | Useful if you need a list of hosts if running in solo mode +['bareos']['clients']['bootstrap_file'] | '/var/lib/bareos/%c.bsr' | Default bootstrap file structure/location +['bareos']['clients']['jobdef_default_messages'] | 'Standard' | Default value for setting the message level in a job definition to override the messages section +['bareos']['clients']['jobdef_default_fileset'] | "#{node['fqdn']}-Fileset" | Default naming convention for filesets +['bareos']['clients']['storage'] | 'File' | Default storage for new clients when added via search + +### Storage Daemon +Provides for a baseline Storage Daemon Config with configurable options + +Attribute | Default Value | Description +-----------------|---------------|------------ +default['bareos']['storage']['name'] | node['fqdn'] | Uses FQDN for naming storages found via search +default['bareos']['storage']['storage_search_query'] | 'roles:bareos_storage' | Default search query string for finding storage servers +default['bareos']['storage']['sd_port'] | 9103 | Default Storage communication port +default['bareos']['storage']['servers'] | %w(node) | List of storage servers you can use if using solo mode +default['bareos']['storage']['max_concurrent_jobs'] | 20 | Default max number of concurrent storage daemon jobs +default['bareos']['storage']['autochanger_enabled'] | false | Used to control autochanger support + +### Director +Provides standard variables for a typical Director configuration -Attribute | Description | Type | Default ------------------|-------------|------|--------- +Attribute | Default Value | Description +-----------------|---------------|------------ +default['bareos']['director']['name'] | node['fqdn'] | Uses FQDN for director naming +default['bareos']['director']['net_name'] | node['fqdn'] | Uses FQDN for DNS resolution +default['bareos']['director']['dir_search_query'] | 'roles:bareos_director' | Default search string to find bareos directors +default['bareos']['director']['dir_port'] | 9101 | Default director communication port +default['bareos']['director']['dir_max_concurrent_jobs'] | 20 | Default max allowable jobs running +default['bareos']['director']['servers'] | %w(node) | List of directors if running in solo mode +default['bareos']['director']['console_commandacl'] | 'status, .status' | Default ACL for console commands +default['bareos']['director']['heartbeat_interval'] | 600 | Proven useful as a default network timeout for communication to director +default['bareos']['director']['catalog_jobdef'] | 'default-catalog-def' | Default name for the Catalog Backup Jobdef name +default['bareos']['director']['conf']['help']['Example Block'] | '# You can put extra configs here.' | Area where you can add any number of possible things to expand your configs +default['bareos']['director']['config_change_notify'] | 'restart' | Default action when director config changes (restart/reload) + +### Subscription Management (Director) +Provides a system counter method if you have a paid service subscription -## Clients -Provides resources for the Catalog (Director configuration) and Filedaemon configurations/templates +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['director']['dir_subscription'] | nil | Required if you have a support contract/licensed installation (activates if not nil) +['bareos']['director']['dir_subs'] | nil | Max number of subs you have signed up for -Attribute | Description | Type | Default ------------------|-------------|------|--------- +### Workstation +Determines if you want to use FQDN or some other way of defining hosts in your management workstation deployment -## Storage Daemon -Provides for a baseline Storage Daemon Config with optional configurables +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['workstation']['name'] | node['fqdn'] | Used to determine header information for bconsole/bat configs -Attribute | Description | Type | Default ------------------|-------------|------|--------- +### Graphite Plugin +A new plugin that will send statistics to a graphite server which can then be used in various ways. -## Director -Provides standard variables for a typical Director configuration +Attribute | Default Value | Description +-----------------|---------------|------------ +['bareos']['plugins']['graphite']['packages'] | varies on platform | Default packages needed to get the plugin to work +['bareos']['plugins']['graphite']['plugin_path'] | '/usr/sbin' | Default location for the plugin that runs in a defined cron job +['bareos']['plugins']['graphite']['config_path'] | '/etc/bareos' | Default directory for the plugin config +['bareos']['plugins']['graphite']['search_query'] | 'roles:bareos_director' | Default search string to populate the director name +['bareos']['plugins']['graphite']['server'] | 'graphite' | Placeholder string for the graphite server DNS name +['bareos']['plugins']['graphite']['graphite_port'] | '2003' | Default graphite communication port +['bareos']['plugins']['graphite']['graphite_data_prefix'] | 'bareos.' | Default prefix for graphite data +['bareos']['plugins']['graphite']['graphite_plugin_src_url'] | 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py' | Default URL to the plugin -Attribute | Description | Type | Default ------------------|-------------|------|--------- +## Recipes -## Subscription Management (Director) -Provides a system counter method if you have a paid service subscription +### default +Installs the Bareos repos (via the repo recipe) and the client filedaemon (via the client recipe). Please NOTE, although it will install these parts, the director will not pick up on the client unless you (by default) create and attach a bareos_client role to hosts you wish to configure automatically. You can also add the host to the director in the unmanaged-host key value hashes. + +### client +Installs the Bareos filedaemon and creates a config file that is linked to available directors on chef server. +You may also feed directors to the config via attributes if running in solo mode. -Attribute | Description | Type | Default ------------------|-------------|------|--------- +### repo +Installs base Bareos repo as well as the Bareos Contrib repo. -## Workstation -Determines if you want to use FQDN or some other way of defining hosts in your management workstation deployment +### database +Installs whichever database is desired per attributes (PostgreSQL/MySQL), installs Bareos database packages and creates the bareos database and user for you. Should also set the database password by default. You may need to recover this from the attributes or set a new one via vault via wrapper recipe. -Attribute | Description | Type | Default ------------------|-------------|------|--------- +### server +Installs necessary Bareos server packages and sets up base configs necessary for server to start. Also creates the config directory (bareos-dir.d) so you can drop whatever outside config files into place and have them get automatically included in your setup. -# Basic Usage +### storage +Installs necessary Bareos storage packages and sets up a default file storage for you to start backing stuff up to right away (configured for ~250GB of volumes by default). -## Roles +### autochanger +This bit will setup an autochanger based on a pretty straight forward has table. Tested with IBM TS3500 Tape Library with 10 Frames and 16 Tape drives. -### Basic bareos\_client role -Install the Bareos Client so hosts can be backup automatically (required) +### workstation +Installs bconsole essentially. I plan to create another recipe for bat (Bareos Administration Tool) and the Bareos Web UI but I haven't gotten around to it yet. -You'll need a searchable client role named ```bareos_client```, for example: -``` +### graphite_plugin +This was an exciting recent addition to the Bareos contrib GitHub repo. This addition in its current form will be dependent on a pending merge request getting accepted but if it isn't merged it can be easily worked around. Should work out of the gate here pretty soon given you adjust the graphite server string in the attributes for a graphite server location. +## Searchable Roles (Used by default) + +### bareos\_client +This example shows how the ```bareos_client``` role can both install the Bareos client side software and when searched against via the server recipe, will add itself to the bareos-dir (Bareos director) configuration and setup a default set of jobs for a client. +``` { "name": "bareos_client", "description": "Example Role for Bareos clients using the chef-bareos Cookbook, used in searches, throws down sources for installs", @@ -98,17 +178,12 @@ You'll need a searchable client role named ```bareos_client```, for example: } ``` -This role has to be applied to all your clients so they can be backed up by this cookbook. - -### Basic bareos\_director role -Install the Bareos Director for scheduling backups (required). - -You'll need a searchable director role named ```bareos_director```, for example: +### bareos\_storage +This example shows a ```bareos_storage``` role which will create a Bareos storage-daemon host. It will install the necessary packages and lay down configuration files you can populate with any number of key value hash tables. You should be able to install this independent of the director(s), please file a ticket if this doesn't work as expected. ``` - { - "name": "bareos_director", - "description": "Example Role for a Bareos director", + "name": "bareos_storage", + "description": "Example Role for a Bareos storage", "json_class": "Chef::Role", "default_attributes": { }, @@ -116,30 +191,25 @@ You'll need a searchable director role named ```bareos_director```, for example: }, "chef_type": "role", "run_list": [ - "role[bareos_client]", - "recipe[chef-bareos::database]", - "recipe[chef-bareos::server]", - "recipe[chef-bareos::workstation]" + "recipe[chef-bareos::storage]" ], "env_run_lists": { } } - ``` -You'll need to run chef-client on the backup server every time you add a new node. Client jobs should be created for you automatically. +### bareos\_director +This role example will install an all-in-one Bareos director server. This includes a "first" client, bareos database, bareos storage, and deploy bconsole to interact with the director. -Running the server recipe should work in chef-solo but you need to populate the ['bareos']['clients'] attribute with an array of client names. +This will also allow clients to populate their filedaemon config via defined search string. -### Basic bareos\_storage role -Install the Bareos Storage Daemon for data transfers (required). +You'll need to run ```chef-client``` on the director after a client gets configured so the director can add and generate the appropriate client related configs. -You'll need a searchable storage role named ```bareos_storage```, for example: +You can populate the ```['bareos']['clients']['unmanaged']``` hash table space with any number of client related configuration lines if you have hosts you either don't plan to search for or want to do custom configurations for. ``` - { - "name": "bareos_storage", - "description": "Example Role for a Bareos storage", + "name": "bareos_director", + "description": "Example Role for a Bareos director", "json_class": "Chef::Role", "default_attributes": { }, @@ -147,63 +217,221 @@ You'll need a searchable storage role named ```bareos_storage```, for example: }, "chef_type": "role", "run_list": [ - "recipe[chef-bareos::storage]" + "role[bareos_client]", + "recipe[chef-bareos::database]", + "recipe[chef-bareos::server]", + "recipe[chef-bareos::workstation]" ], "env_run_lists": { } } +``` +## Example customizable key value hash template configurations +These are the preset default hashes to get a baseline configuration on a new bareos server. You can manipulate these as you see fit via recipe logic or searches or whatever you want. These will at least get you going. +### clients +``` +# Default Client Config when populated via search +default['bareos']['clients']['conf'] = { + 'FDPort' => '9102', + 'File Retention' => '30 days', + 'Job Retention' => '6 months', + 'AutoPrune' => 'yes', + 'Maximum Concurrent Jobs' => '20' +} +``` +``` +# Example Unmanaged client if client is unmanaged or custom +default['bareos']['clients']['unmanaged']['unmanaged-client-fd'] = { + 'Address' => 'unmanaged-client', + 'Password' => 'onefbofnerwob', + 'Catalog' => 'MyCatalog', + 'FDPort' => '9102' +} ``` +#### autochanger (if using tape storage) +``` +# Example/Test Tape Autochanger Configurations +if node['bareos']['storage']['autochanger_enabled'] == true + default['bareos']['storage']['autochangers']['autochanger-0'] = { + 'Device' => [ + 'tapedrive-0', + 'tapedrive-1' + ], + 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], + 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] + } -## Recipes and Hashable Configurations + default['bareos']['storage']['autochangers']['autochanger-1'] = { + 'Device' => [ + 'tapedrive-0' + ], + 'Changer Device' => ['/dev/tape/by-id/scsi-1TANDBERGStorageLoader_SOMEAUTOCHANGER'], + 'Changer Command' => ['"/usr/lib/bareos/scripts/mtx-changer %c %o %S %a %d"'] + } -### Recipes -#### default.rb -Installs necessary repos and includes the Bareos client recipe -#### client.rb -Installs client packages and creates a config file that is linked to available directors on chef server. -You may also feed directors to the config via attributes if running in solo mode. -#### repo.rb -Installs base Bareos repo as well as the Bareos Contrib repo. -#### database.rb -Installs whichever database is desired per attributes (PostgreSQL/MySQL), installs Bareos database packages and creates the bareos database and user for you. Should also set the database password by default. You may need to recover this from the attributes or set a new one via vault via wrapper recipe. -#### server.rb -Installs necessary Bareos server packages and sets up base configs necessary for server to start. Also creates the config directory (bareos-dir.d) so you can drop whatever outside config files into place and have them get automatically included in your setup. -#### storage.rb -Installs necessary Bareos storage packages and sets up a default file storage for you to start backing stuff up to right away (configured for ~250GB of volumes by default). -#### autochanger.rb -This bit will setup an autochanger based on a pretty straight forward has table. Tested with IBM TS3500 Tape Library with 10 Frames and 16 Tape drives. -#### workstation.rb -Installs bconsole essentially. I plan to create another recipe for bat (Bareos Administration Tool) and the Bareos Web UI but I haven't gotten around to it yet. -#### graphite_plugin.rb -This was an exciting recent addition to the Bareos contrib GitHub repo. This addition in its current form will be dependent on a pending merge request getting accepted but if it isn't merged it can be easily worked around. Should work out of the gate here pretty soon given you adjust the graphite server string in the attributes for a graphite server location. -### Hashable Configurations for templates -#### bconsole -#### clients -#### autochanger + default['bareos']['storage']['devices']['tapedrive-0'] = { + 'DeviceType' => 'tape', + 'DriveIndex' => '0', + 'ArchiveDevice' => 'dev/nst0', + 'MediaType' => 'lto', + 'Autochanger' => 'no', + 'AutomaticMount' => 'no', + 'MaximumFileSize' => '10GB' + } + + default['bareos']['storage']['devices']['tapedrive-1'] = { + 'DeviceType' => 'tape', + 'DriveIndex' => '0', + 'ArchiveDevice' => 'dev/nst0', + 'MediaType' => 'lto', + 'Autochanger' => 'no', + 'AutomaticMount' => 'no', + 'MaximumFileSize' => '10GB' + } +``` #### dir\_helper +``` +default['bareos']['director']['conf']['help']['Example Block'] = '# You can put extra configs here.' +``` #### filesets +``` +# Default Filesets +default['bareos']['clients']['filesets']['default'] = { + 'options' => { + 'signature' => 'MD5' + }, + 'include' => { + 'File' => ['/', '/home'], + 'Exclude Dir Containing' => ['.bareos_ignore'] + }, + 'exclude' => { + 'File' => [ + '/var/lib/bareos', + '/var/lib/bareos/storage', + '/var/lib/pgsql', + '/var/lib/mysql', + '/proc', + 'tmp', + '/.journal', + '/.fsck', + '/spool' + ] + } +} +``` #### job\_definitions (jobdefs) +``` +# Default Job Definitions +default['bareos']['clients']['job_definitions']['default-def'] = { + 'Level' => 'Incremental', + 'Fileset' => 'default-fileset', + 'Schedule' => 'monthly', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Priority' => '10', + 'Write Bootstrap' => '"/var/lib/bareos/%c.bsr"', + 'SpoolData' => 'no' +} + +default['bareos']['clients']['job_definitions']['default-catalog-def'] = { + 'Level' => 'Full', + 'Fileset' => 'Catalog', + 'Schedule' => 'WeeklyCycleAfterBackup', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Allow Duplicate Jobs' => 'no' +} + +default['bareos']['clients']['job_definitions']['default-restore-def'] = { + 'Fileset' => 'default-fileset', + 'Storage' => 'default-file-storage', + 'Messages' => 'Standard', + 'Pool' => 'default-file-pool', + 'Priority' => '7', + 'Where' => '/tmp/bareos-restores' +} +``` #### jobs +Director Jobs: +``` +default['bareos']['director']['jobs'] = nil +``` +Client Jobs: +``` +# Example Jobs +default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Backup', + 'JobDefs' => 'default-def' +} + +default['bareos']['clients']['jobs']["#{node.default['bareos']['clients']['name']}-restore-job"] = { + 'Client' => "#{node['bareos']['clients']['name']}-fd", + 'Type' => 'Restore', + 'JobDefs' => 'default-restore-def' +} +``` + #### pools +``` +# Default Pools +default['bareos']['clients']['pools']['default-file-pool'] = { + 'Pool Type' => 'Backup', + 'Recycle' => 'yes', + 'Volume Retention' => '30 days', + 'Maximum Volume Bytes' => '10G', + 'Maximum Volumes' => '25', + 'LabelFormat' => 'FileVolume-' +} +``` #### schedules +``` +# Default Schedules +default['bareos']['clients']['schedules']['monthly'] = { + 'Description' => [ + 'Default Monthly Schedule' + ], + 'Run' => [ + 'Full 1st sun at 23:05', + 'Differential 2nd-5th sun at 23:05', + 'Incremental mon-sat at 23:05' + ], + 'Enabled' => [ + 'yes' + ] +} +``` #### sd\_helper +``` +default['bareos']['storage']['conf']['help']['Example Block'] = '# You can put extra configs here.' +``` #### storages +``` +# Default Storages +default['bareos']['clients']['storages']['default-file-storage'] = { + 'Address' => node['bareos']['storage']['name'], # N.B. Use a fully qualified name here + 'Device' => 'FileStorage', + 'Media Type' => 'File' +} +``` # Contributing 1. Fork the repository on Github 2. Create a named feature branch (like ```add_component_x```) 3. Write your change -4. Write tests for your change (if applicable) -5. Run the tests, ensuring they all pass -6. Submit a Pull Request using Github +4. Write kitchen and/or chefspec (rspec) tests for your change (if possible) +5. Run the tests, ensuring they all pass or travis-ci will do it for you +6. Submit a Pull Request using GitHub ## License and Authors ### License -Copyright 2014 Leonard TAVAE +Copyright (C) 2016 Leonard TAVAE Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From a82483575dd9610970f98a46329792ed0f81418f Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:38:28 -0700 Subject: [PATCH 308/311] Found a deprecated attribute, file a ticket if this was not right --- attributes/default.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index ea69dce..79509a9 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -87,7 +87,6 @@ default['bareos']['storage']['storage_search_query'] = 'roles:bareos_storage' default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['servers'] = %w(node) -default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['max_concurrent_jobs'] = 20 default['bareos']['storage']['autochanger_enabled'] = false default['bareos']['storage']['conf']['help']['Example Block'] = '# You can put extra configs here.' From b1a52d91c9e99117204851b0f2498dd67875c1e7 Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 17:38:52 -0700 Subject: [PATCH 309/311] Updating year for license --- recipes/autochanger.rb | 2 +- recipes/client.rb | 2 +- recipes/database.rb | 2 +- recipes/default.rb | 2 +- recipes/repo.rb | 2 +- recipes/server.rb | 2 +- recipes/storage.rb | 2 +- recipes/workstation.rb | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/autochanger.rb b/recipes/autochanger.rb index 2510439..f9e9b09 100644 --- a/recipes/autochanger.rb +++ b/recipes/autochanger.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: autochanger diff --git a/recipes/client.rb b/recipes/client.rb index c42bf6e..b599ab2 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: client diff --git a/recipes/database.rb b/recipes/database.rb index 0d6359d..c6c83c0 100644 --- a/recipes/database.rb +++ b/recipes/database.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: database diff --git a/recipes/default.rb b/recipes/default.rb index c5d5551..1976bb2 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: default diff --git a/recipes/repo.rb b/recipes/repo.rb index 5b04bf6..c6b9d22 100644 --- a/recipes/repo.rb +++ b/recipes/repo.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: repo diff --git a/recipes/server.rb b/recipes/server.rb index 008d319..c62c072 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: server diff --git a/recipes/storage.rb b/recipes/storage.rb index 902df52..b41f572 100644 --- a/recipes/storage.rb +++ b/recipes/storage.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: storage diff --git a/recipes/workstation.rb b/recipes/workstation.rb index 652cae3..fb1d1e3 100644 --- a/recipes/workstation.rb +++ b/recipes/workstation.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Copyright (C) 2014 Leonard TAVAE +# Copyright (C) 2016 Leonard TAVAE # # Cookbook Name:: chef-bareos # Recipe:: workstation From 4c312f796b13fca2001fc60a9647ff030db86d08 Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 18:56:03 -0700 Subject: [PATCH 310/311] lacked some formatting --- README.md | 141 +++++++++++++++++++++++++++--------------------------- 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index c9646ee..a715124 100644 --- a/README.md +++ b/README.md @@ -22,109 +22,110 @@ This cookbook installs and configures backups based on [BAREOS](https://www.bare ### Repository Assists with adding necessary sources for installing Bareos -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['url'] | 'http://download.bareos.org/bareos/release' | Main installation URL -['bareos']['contrib_url'] | 'http://download.bareos.org/bareos/contrib' | Main contrib installation URL -['bareos']['version'] | '15.2' | Default Bareos Version + +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['url'] | 'http://download.bareos.org/bareos/release' | Main installation URL +| ['bareos']['contrib_url'] | 'http://download.bareos.org/bareos/contrib' | Main contrib installation URL +| ['bareos']['version'] | '15.2' | Default Bareos Version For other platform specific attributes please see default attributes file for more detail. ### Messages Defines default admin e-mail address for service notifications and what messages to care about -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['messages']['mail_to'] | "bareos@#{node['domain']}" | Default messages e-mail destination -['bareos']['messages']['default_messages'] | 'Standard' | Default client message capture level -['bareos']['messages']['default_admin_messages'] | 'all, !skipped, !restored' | Default server message capture level +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['messages']['mail_to'] | "bareos@#{node['domain']}" | Default messages e-mail destination +| ['bareos']['messages']['default_messages'] | 'Standard' | Default client message capture level +| ['bareos']['messages']['default_admin_messages'] | 'all, !skipped, !restored' | Default server message capture level ### Database Populates the Catalog resource in the main Director configuration -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['database']['catalog_name'] | 'MyCatalog' | Default catalog name -['bareos']['database']['database_type'] | 'postgresql' | Default database installment indicator -['bareos']['database']['dbdriver'] | 'postgresql' | Config entry for type of database -['bareos']['database']['dbname'] | 'bareos' | Default database name -['bareos']['database']['dbuser'] | 'bareos' | Default database user -['bareos']['database']['dbpassword'] | *blank string* | Default gets generated by postgresql cookbook, unless specified here -['bareos']['database']['dbaddress'] | nil | This is often just the localhost, so this is only needed in certain cases +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['database']['catalog_name'] | 'MyCatalog' | Default catalog name +| ['bareos']['database']['database_type'] | 'postgresql' | Default database installment indicator +| ['bareos']['database']['dbdriver'] | 'postgresql' | Config entry for type of database +| ['bareos']['database']['dbname'] | 'bareos' | Default database name +| ['bareos']['database']['dbuser'] | 'bareos' | Default database user +| ['bareos']['database']['dbpassword'] | *blank string* | Default gets generated by postgresql cookbook, unless specified here +| ['bareos']['database']['dbaddress'] | nil | This is often just the localhost, so this is only needed in certain cases ### Clients Provides resources for the Catalog (Director configuration) and Filedaemon configurations/templates -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['clients']['name'] | node['fqdn'] | Uses the node FQDN by default as prefix for filedaemon name -['bareos']['clients']['net_name'] | node['fqdn'] | DNS Network name used to resolve client -['bareos']['clients']['fd_port'] | 9102 | Default filedaemon port -['bareos']['clients']['max_concurrent_jobs'] | 20 | Default number of concurrent jobs -['bareos']['clients']['heartbeat_interval'] | 600 | Proven a useful default value, change as needed -['bareos']['clients']['client_search_query'] | 'roles:bareos_client' | Default search query to find Bareos clients -['bareos']['clients']['client_list'] | %w(node) | Useful if you need a list of hosts if running in solo mode -['bareos']['clients']['bootstrap_file'] | '/var/lib/bareos/%c.bsr' | Default bootstrap file structure/location -['bareos']['clients']['jobdef_default_messages'] | 'Standard' | Default value for setting the message level in a job definition to override the messages section -['bareos']['clients']['jobdef_default_fileset'] | "#{node['fqdn']}-Fileset" | Default naming convention for filesets -['bareos']['clients']['storage'] | 'File' | Default storage for new clients when added via search +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['clients']['name'] | node['fqdn'] | Uses the node FQDN by default as prefix for filedaemon name +| ['bareos']['clients']['net_name'] | node['fqdn'] | DNS Network name used to resolve client +| ['bareos']['clients']['fd_port'] | 9102 | Default filedaemon port +| ['bareos']['clients']['max_concurrent_jobs'] | 20 | Default number of concurrent jobs +| ['bareos']['clients']['heartbeat_interval'] | 600 | Proven a useful default value, change as needed +| ['bareos']['clients']['client_search_query'] | 'roles:bareos_client' | Default search query to find Bareos clients +| ['bareos']['clients']['client_list'] | %w(node) | Useful if you need a list of hosts if running in solo mode +| ['bareos']['clients']['bootstrap_file'] | '/var/lib/bareos/%c.bsr' | Default bootstrap file structure/location +| ['bareos']['clients']['jobdef_default_messages'] | 'Standard' | Default value for setting the message level in a job definition to override the messages section +| ['bareos']['clients']['jobdef_default_fileset'] | "#{node['fqdn']}-Fileset" | Default naming convention for filesets +| ['bareos']['clients']['storage'] | 'File' | Default storage for new clients when added via search ### Storage Daemon Provides for a baseline Storage Daemon Config with configurable options -Attribute | Default Value | Description ------------------|---------------|------------ -default['bareos']['storage']['name'] | node['fqdn'] | Uses FQDN for naming storages found via search -default['bareos']['storage']['storage_search_query'] | 'roles:bareos_storage' | Default search query string for finding storage servers -default['bareos']['storage']['sd_port'] | 9103 | Default Storage communication port -default['bareos']['storage']['servers'] | %w(node) | List of storage servers you can use if using solo mode -default['bareos']['storage']['max_concurrent_jobs'] | 20 | Default max number of concurrent storage daemon jobs -default['bareos']['storage']['autochanger_enabled'] | false | Used to control autochanger support +| Attribute | Default Value | Description +|------------------|---------------|------------ +| default['bareos']['storage']['name'] | node['fqdn'] | Uses FQDN for naming storages found via search +| default['bareos']['storage']['storage_search_query'] | 'roles:bareos_storage' | Default search query string for finding storage servers +| default['bareos']['storage']['sd_port'] | 9103 | Default Storage communication port +| default['bareos']['storage']['servers'] | %w(node) | List of storage servers you can use if using solo mode +| default['bareos']['storage']['max_concurrent_jobs'] | 20 | Default max number of concurrent storage daemon jobs +| default['bareos']['storage']['autochanger_enabled'] | false | Used to control autochanger support ### Director Provides standard variables for a typical Director configuration -Attribute | Default Value | Description ------------------|---------------|------------ -default['bareos']['director']['name'] | node['fqdn'] | Uses FQDN for director naming -default['bareos']['director']['net_name'] | node['fqdn'] | Uses FQDN for DNS resolution -default['bareos']['director']['dir_search_query'] | 'roles:bareos_director' | Default search string to find bareos directors -default['bareos']['director']['dir_port'] | 9101 | Default director communication port -default['bareos']['director']['dir_max_concurrent_jobs'] | 20 | Default max allowable jobs running -default['bareos']['director']['servers'] | %w(node) | List of directors if running in solo mode -default['bareos']['director']['console_commandacl'] | 'status, .status' | Default ACL for console commands -default['bareos']['director']['heartbeat_interval'] | 600 | Proven useful as a default network timeout for communication to director -default['bareos']['director']['catalog_jobdef'] | 'default-catalog-def' | Default name for the Catalog Backup Jobdef name -default['bareos']['director']['conf']['help']['Example Block'] | '# You can put extra configs here.' | Area where you can add any number of possible things to expand your configs -default['bareos']['director']['config_change_notify'] | 'restart' | Default action when director config changes (restart/reload) +| Attribute | Default Value | Description +|------------------|---------------|------------ +| default['bareos']['director']['name'] | node['fqdn'] | Uses FQDN for director naming +| default['bareos']['director']['net_name'] | node['fqdn'] | Uses FQDN for DNS resolution +| default['bareos']['director']['dir_search_query'] | 'roles:bareos_director' | Default search string to find bareos directors +| default['bareos']['director']['dir_port'] | 9101 | Default director communication port +| default['bareos']['director']['dir_max_concurrent_jobs'] | 20 | Default max allowable jobs running +| default['bareos']['director']['servers'] | %w(node) | List of directors if running in solo mode +| default['bareos']['director']['console_commandacl'] | 'status, .status' | Default ACL for console commands +| default['bareos']['director']['heartbeat_interval'] | 600 | Proven useful as a default network timeout for communication to director +| default['bareos']['director']['catalog_jobdef'] | 'default-catalog-def' | Default name for the Catalog Backup Jobdef name +| default['bareos']['director']['conf']['help']['Example Block'] | '# You can put extra configs here.' | Area where you can add any number of possible things to expand your configs +| default['bareos']['director']['config_change_notify'] | 'restart' | Default action when director config changes (restart/reload) ### Subscription Management (Director) Provides a system counter method if you have a paid service subscription -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['director']['dir_subscription'] | nil | Required if you have a support contract/licensed installation (activates if not nil) -['bareos']['director']['dir_subs'] | nil | Max number of subs you have signed up for +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['director']['dir_subscription'] | nil | Required if you have a support contract/licensed installation (activates if not nil) +| ['bareos']['director']['dir_subs'] | nil | Max number of subs you have signed up for ### Workstation Determines if you want to use FQDN or some other way of defining hosts in your management workstation deployment -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['workstation']['name'] | node['fqdn'] | Used to determine header information for bconsole/bat configs +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['workstation']['name'] | node['fqdn'] | Used to determine header information for bconsole/bat configs ### Graphite Plugin A new plugin that will send statistics to a graphite server which can then be used in various ways. -Attribute | Default Value | Description ------------------|---------------|------------ -['bareos']['plugins']['graphite']['packages'] | varies on platform | Default packages needed to get the plugin to work -['bareos']['plugins']['graphite']['plugin_path'] | '/usr/sbin' | Default location for the plugin that runs in a defined cron job -['bareos']['plugins']['graphite']['config_path'] | '/etc/bareos' | Default directory for the plugin config -['bareos']['plugins']['graphite']['search_query'] | 'roles:bareos_director' | Default search string to populate the director name -['bareos']['plugins']['graphite']['server'] | 'graphite' | Placeholder string for the graphite server DNS name -['bareos']['plugins']['graphite']['graphite_port'] | '2003' | Default graphite communication port -['bareos']['plugins']['graphite']['graphite_data_prefix'] | 'bareos.' | Default prefix for graphite data -['bareos']['plugins']['graphite']['graphite_plugin_src_url'] | 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py' | Default URL to the plugin +| Attribute | Default Value | Description +|------------------|---------------|------------ +| ['bareos']['plugins']['graphite']['packages'] | varies on platform | Default packages needed to get the plugin to work +| ['bareos']['plugins']['graphite']['plugin_path'] | '/usr/sbin' | Default location for the plugin that runs in a defined cron job +| ['bareos']['plugins']['graphite']['config_path'] | '/etc/bareos' | Default directory for the plugin config +| ['bareos']['plugins']['graphite']['search_query'] | 'roles:bareos_director' | Default search string to populate the director name +| ['bareos']['plugins']['graphite']['server'] | 'graphite' | Placeholder string for the graphite server DNS name +| ['bareos']['plugins']['graphite']['graphite_port'] | '2003' | Default graphite communication port +| ['bareos']['plugins']['graphite']['graphite_data_prefix'] | 'bareos.' | Default prefix for graphite data +| ['bareos']['plugins']['graphite']['graphite_plugin_src_url'] | 'https://raw.githubusercontent.com/bareos/bareos-contrib/master/misc/performance/graphite/bareos-graphite-poller.py' | Default URL to the plugin ## Recipes From 01a2b547056503a21bdca19b2514819d0f4cef1e Mon Sep 17 00:00:00 2001 From: I Smith Date: Fri, 13 May 2016 19:30:17 -0700 Subject: [PATCH 311/311] Yeah...that was needed.. whoops! Adding back the default['bareos']['storage']['sd_mon_enable'] = 'yes' line I removed in my last few commits --- attributes/default.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/attributes/default.rb b/attributes/default.rb index 79509a9..a452e96 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -88,6 +88,7 @@ default['bareos']['storage']['sd_port'] = 9103 default['bareos']['storage']['servers'] = %w(node) default['bareos']['storage']['max_concurrent_jobs'] = 20 +default['bareos']['storage']['sd_mon_enable'] = 'yes' default['bareos']['storage']['autochanger_enabled'] = false default['bareos']['storage']['conf']['help']['Example Block'] = '# You can put extra configs here.'