On May 5, 12:34 am, [email protected] wrote:
> Hi all,
>
> I'm trying to figure out how to automatically configure my nodes with  
> amanda backup client.
>
> What I want to achieve is that the server have an entry created in the  
> /etc/amanda/(Daily|Weekly|Monthly)/disklist.conf file on the server.
>
> The disklist.conf file lists entries like so:
> nodename partition alias {
> a
> bunch
> of
> vars}
>
> anothernodename partition alias {
> a
> bunch
> of
> vars
>
> }
>
> I want that to come from a 'role' class assignment - ie, a webserver has  
> the webserver role and has a backup template.
>
> I was hoping to use a define like so:
> define amanda::client::takebackup ($type, $period, $compress = undef) {
> # take the hostname from the name var.
> $myhost = $name
>
> @@file { "/etc/amanda/$period/disklist.conf":
> ensure => present,
> owner => "amandabackup",
> group => "disk",
> mode => 0600,
> content => template("amanda/$period/$type.erb"),
> tag => amandabackupdisklist,
>
> }
> } #end define
>
> And activate the resource like so:
> devel_buildserver.pp:
> class roles::devel_buildserver {
> include amanda::client
> amanada::client::takebackup { $fqdn:
> type => "dev_build",
> period => "Daily",
> compress => false,
>
> }
> } #end class
>
> The erb is like so:
> dev_build.erb:
> # This is a puppet controlled disklist file for dev_build
> <%= myhost %> "/" "/" {
> zmc_unix_base
> encrypt none
> <% if has_variable?("compress") then -%>
> compress client best
> <% else -%>
> compress none
> <% end -%>
> estimate calcsize server
> property "zmc_type" "unix"
> property "zmc_disklist" "Daily"
> property "zmc_version" "3"
> property "zmc_extended_attributes" "gtar"
> property "zmc_amanda_app" "gtar"
> property "zmc_show_advanced" "on"
> property "creation_time" "2011-04-19 23:38:01"
> property "zmc_occ" "33438030906"
> property "last_modified_time" "2011-04-20 18:56:43"
> exclude "/proc,/srv,/sys"
> property "zmc_amcheck_date" "20110420185643"
> zmc_gtar_app
>
> }
>
> Then in the server class I wanted to realize the resource like so:
> class amanda::server {
> ...
> some other stuff
> ...
> File <<| tag == 'amandabackupdisklist' |>>
>
> }
>
> This is not working. The file is not being realized on the server node. I  
> don't think the way I've gone about it will ever work though the way I  
> first thought - hence this call for help... :)
>
> How can I get this to work? What has got me especially worried is the  
> appending of node data to the disklist.conf file - how to do that?


A serious flaw in the approach you described is that you have all your
amanda clients exporting the *same* few resources (/etc/amanda/$period/
disklist.conf).  I do not know whether that's related to the resources
not being collected on the server, but the best you could hope for
that way is that only one of the clients' versions of each file is
applied.

What you need is for each client to export a separate resource for the
server to collect.  In other words, each client's piece of the overall
amanda configuration needs to be its own resource, with a globally
unique name and a physical manifestation separate from all the
others'.

For example, if amanda's config file syntax has some sort of "include"
statement, then make each client's piece of the configuration go into
its own file (maintain uniquess by including the host name in the file
name) and have the main config file include them all.  Ideal in this
case would be if the amanda "include" statement supports globbing, but
if necessary, it would be possible to template the file to contain all
the needed per-file "include" statements.

If amanda is not so helpful, then you need to come up with a resource
that represents one piece of a file (remember that each piece still
needs a globally-unique name).  There might be something like this in
the Forge, but I'm not sure.  You could perhaps use Augeas resources
for this purpose, or maybe you could write a defined type that
achieves it.  As a last resort, there is always the option of a Ruby
custom type.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to