On Tue, Nov 15, 2011 at 8:05 AM, Stephan
<stephan.eckwei...@admin.ox.ac.uk> wrote:
> Hi all,
>
> here is what I have:
>
> A module that is responsible to roll out and configure TSM (a backup
> tool). Basically I need a text file that mentions all directories that
> have to be backed up. I want to make it a virtual resource and let
> other modules configure which parts of it have to be backed up, e.g.
> configure in the apache module that the apache logs of each defined
> virtual server have to be backed up:
>
> The node.pp is configured like this:
>
> apache::config {"virtualserver1":
>    blah
> }
> apache:config {"virtualserver2":
>    blah
> }
>
> @tsm::config { "$hostname":
>    tsm_backup => ["/custdir1","/custdir2"]
> }
>
> The @ means this is a virtual Define-based resource, so it is not
> implemented until it gets realized.
>
> /custdir1 and /custdir2 denote custom directories that have to be
> backed up, but aren't managed by other puppet modules.
>
> One module is supposed to add some directories to tsm_backup, I use
> this configuration inside the apache module's config.pp:
>
> Tsm::Config<| title == $hostname |> {
>    tsm_backup +> ["$apache_logs,$docroot],
> }
>
> I can then use this array in the template for the conf file (dsm.sys,
> virtualmountpoint and Domain, for those who know TSM). Up until here
> it all works fine. The config file will contain /custdir1, /custdir2, /
> apache/virtualserver1/logs, /apache/virtualserver2/logs, apache/
> virtualserver1/docroot, apache/virtualserver2/docroot
>
> But when I want to configure another module to also add its
> directories to tsm_backup, so basically have another module, say
> postfix config.pp which contains this:
>
> Tsm::Config<| title == $hostname |> {
>    tsm_backup +> ["$postfix_logs],
> }
>
> It will either contain the apache backup dirs OR the postfix backup
> dirs, depending on which <| |> it finds first, but never both.
>
> This is unexpected, since if I use the same construct for non define-
> based virtual resources, like a user (see
> https://groups.google.com/group/puppet-users/browse_thread/thread/c13c1936dcd939fd/cff48a8c03734336
> )
>
> Does anybody have an idea?

I have a very rough proof of concept that might fit (i.e. not official
and likely buggy, though feedback welcomed):
https://github.com/nanliu/puppet-export_resources

The github page have explanation some of the export resource
limitation it's trying to solve. The idea there is for exporting
systems to have a default resource attributes:
/data/${env}/tsm_backup/hostname.yaml

Each app export it's data to a subdirectory:
/data/${env}/tsm_backup/hostname/tsm_backup/apache.yaml
/data/${env}/tsm_backup/hostname/tsm_backup/postfix.yaml
...

and finally on the target system import_resource will create a
resource hash suitable for create_resources function
(https://github.com/puppetlabs/puppetlabs-create_resources).

Thanks,

Nan

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

Reply via email to