New Resource Type for bareos

72 views
Skip to first unread message

Björn

unread,
Jan 21, 2016, 9:23:04 AM1/21/16
to Puppet Users
Hello,

I try to make the bareos puppet module ready for puppetdb and fully automatic configuration.

When I understand correctly, I'll need a resource type to export it and bring the client configuration on the bareos server finally.

$ cat bareos/lib/puppet/type/bareos_client.rb
Puppet::Type.newtype(:bareos_client) do
  desc
'TEST'
  ensurable
  newparam
(:name, :isnamevar => true) do
    desc
"The name of the client."
 
end
end

$ tail bareos/manifests/client.pp
    mode    
=> '0644',
    owner  
=> 'bareos',    
   
group   => 'bareos',
 
}

 
@@bareos_client{ $::hostname:
 
}

 
Bareos_client <<| |>>
}

I get this error when I make a puppet run on the client:
Error: /Stage[main]/Bareos::Client/Bareos_client[PC3256CO]: Could not evaluate: No ability to determine if bareos_client exists
/usr/lib/ruby/site_ruby/1.8/puppet/property/ensure.rb:85:in `retrieve'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1048:in `
retrieve'
/usr/lib/ruby/site_ruby/1.8/puppet/type.rb:1076:in `retrieve_resource'

/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:236:in `from_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/resource_harness.rb:19:in `
evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:204:in `apply'

/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:217:in `eval_resource'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `
call'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `evaluate'

/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:335:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `
realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:334:in `thinmark'

/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:147:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/graph/relationship_graph.rb:118:in `
traverse'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:138:in `evaluate'

/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:169:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/util/log.rb:149:in `
with_destination'
/usr/lib/ruby/site_ruby/1.8/puppet/transaction/report.rb:112:in `as_logging_destination'

/usr/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:168:in `apply'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:120:in `
apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:161:in `benchmark'

/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:160:in `
benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:119:in `apply_catalog'

/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:227:in `run_internal'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:134:in `
run'
/usr/lib/ruby/site_ruby/1.8/puppet/context.rb:64:in `override'

/usr/lib/ruby/site_ruby/1.8/puppet.rb:246:in `override'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:133:in `
run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `run'

/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:20:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:47:in `
run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:117:in `with_client'

/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:44:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:82:in `
run_in_fork'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'

/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `call'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:179:in `
controlled_run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:41:in `run'

/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:361:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:327:in `
run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:381:in `run'

/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:507:in `plugin_hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:381:in `
run'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:496:in `exit_on_fail'

/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:381:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:146:in `
run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:92:in `execute'

/usr/bin/puppet:8

Thanks in advance.

Regards,
Björn

Thomas Bendler

unread,
Jan 26, 2016, 10:48:52 AM1/26/16
to puppet...@googlegroups.com
Hi Björn,

depends on how you would like to implement the fully automatic configuration. I do this on the server side because backup is nothing that apply out of the box after provisioning to the client and server. Under normal circumstances I would like to add a client only to the backup if really needed. Therefore I used an array in my module to specify the client:


The module is still v0.1.0, so it’s not yet feature complete and not released on the forge but works the way I need it. I think I’ll release it on the forge sometime in Q1/2016 when missing features are implemented.

Regards Thomas

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/11c87300-bd37-4e99-8f19-cb3b28212d6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Björn

unread,
Jan 27, 2016, 11:06:43 AM1/27/16
to Puppet Users
Hi Thomas,

I got a hiera group of linux boxes. All of these should have the bareos client and should backup a standard fileset for instance /var/log.
Okay, the backup client array on the master module would work, but if you forget to add a backup client you got no backup. Now I'm dreaming from a implementation through puppetdb like the nagios resource types.
Or a solution that all backup clients automaticly register at the server. From my point of view the automic configuration is preferable, because a missing backup can have the same impact as missing monitoring.

May there are better solutions to handle it without puppetdb, I'm not sure.

Regards,
Björn

Thomas Bendler

unread,
Feb 2, 2016, 8:17:49 AM2/2/16
to puppet-users
Hi Björn,

do you have a your code on i.e. github so that I can take a look on it or is it restricted? I use Foreman for the backup definition, I have global smart parameters setting with file-fd to true and a configuration group backup-client. All hosts that belong to this configuration group get the client installed and activated. On the director host I add the clients I would like to backup. This result in a standard set of files, for upcoming versions I plan to make something like backup class gold, silver, bronze with different retention times and a scope type of thing for different filesets. But this is not yet implemented, not enough time. Maybe adding some functionality in the future like, there is a backup client installed so a basic, bronze set is scheduled in the backup might be a cool idea, but I guess it's not that easy to implement with focus on reusable modules and also with space management in mind.

Regards Thomas


For more options, visit https://groups.google.com/d/optout.



--
performance, security, automation, SAP
cimt consulting ag, Burchardstrasse 17, 20095 Hamburg
fon: +49 (163) 6081 302, fax: +49 (40) 5 33 02-22, web: www.cimt.de
key: FED7C867 at pgp.mit.edu

Sitz der Gesellschaft: Hamburg, Amtsgericht Hamburg, HRB 74173
Vorstand: Christoph Friedlaender, Dr.-Ing. Thorsten Kuhlmann
Vorsitzender des Aufsichtsrats: Christian Gottsmann
Reply all
Reply to author
Forward
0 new messages