Eiwe Lingefors
2008-Nov-05 19:54 UTC
[Puppet Users] Managing recursive directories in a "waterfall" configuration
The subject may not make a lot of sense so let me try and explain. I''ve searched the archives and come up short so my apologies if this has indeed been addressed before. I have a function that looks like this: define remotedir($mode, $owner, $group, $source, $ensure = directory, $recurse = inf) { file { $name: mode => $mode, owner => $owner, group => $group, ensure => $ensure, recurse => $recurse, source => [ "puppet://$server/dist/host/$host/$source", "puppet://$server/dist/farm/$farm/$source", "puppet://$server/dist/colo/$colo/$type/$source", "puppet://$server/dist/colo/$colo/common/$source", "puppet://$server/dist/type/$type/$source", "puppet://$server/dist/type/common/$source" ] } } It works great and as expected it prefers files higher up in the list. However, I would like the "common" files (at the bottom of the list) to always be included. I have not found a way to accomplish this since in its present form it won''t ever get there since it prefers files higher in the list. If I create a function to grab the common files I end up with a collision since both functions then try to manage the same directory. I would like to try to avoid managing individual files. For example, we have a bunch of custom scripts in /usr/local/sbin and right now a class like this: class farm_localsbin { remotedir { "/usr/local/sbin": source => "usr/local/sbin", mode => 755, owner => root, group => root; } } This gets included from the node definition and grabs all the /usr/local/sbin/* files specific to that "farm" as would be expected. It does NOT grab the "common" files like I would want, due to the aforementioned issues. Do you understand what I''m rambling on about? Is there a way to accomplish this? Please let me know if you need any further clarification or examples and I''ll be happy to provide it. Thanks, Eiwe Lingefors -- Eiwe Lingefors <eiwe@lingefors.name> --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Luke Kanies
2008-Nov-12 23:24 UTC
[Puppet Users] Re: Managing recursive directories in a "waterfall" configuration
On Nov 5, 2008, at 11:54 AM, Eiwe Lingefors wrote:> The subject may not make a lot of sense so let me try and explain. > I''ve searched the archives and come up short so my apologies if this > has indeed been addressed before. > > I have a function that looks like this: > > define remotedir($mode, $owner, $group, $source, $ensure = directory, > $recurse = inf) { > file { > $name: > mode => $mode, > owner => $owner, > group => $group, > ensure => $ensure, > recurse => $recurse, > source => [ > "puppet://$server/dist/host/$host/$source", > "puppet://$server/dist/farm/$farm/$source", > "puppet://$server/dist/colo/$colo/$type/ > $source", > "puppet://$server/dist/colo/$colo/common/ > $source", > "puppet://$server/dist/type/$type/$source", > "puppet://$server/dist/type/common/$source" > ] > } > } > > It works great and as expected it prefers files higher up in the list. > However, I would like the "common" files (at the bottom of the list) > to always be included. I have not found a way to accomplish this since > in its present form it won''t ever get there since it prefers files > higher in the list.Use ''sourceselect => all'' in your file statements; that will result in all of the files that exist getting copied down. There''s no way to get some but not all of the existing files, though. -- The conception of two people living together for twenty-five years without having a cross word suggests a lack of spirit only to be admired in sheep. --Alan Patrick Herbert --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---