Hello there I''m deploying a program which has generic and OS specific (as well as architecture, but that''s a minor issue). So in essence i''m deploying from blah_generic/etc recursive and then blah_linux/etc . I need the files from both operations, but was hitting some snags (I''ve found a work around): 1) the second operation replaces the files from the first operation. 2) I was thinking symlinks, but i doubt that would be very maintainable. 3) then I was thinking copy, but then i have issues with maintainability and consumption of extra space. 2 and 3 aren''t major issues, but there are conceivably going to be updates so i would like it to remain clean. My work around (which might be the solution) is that instead of a recursive copy of the directory into the same place, i copy the specified files, but alas that isn''t dynamic and would require extra work when upgrade time comes.... I''m guessing i''m missing a type operation... here is what i''ve got: class blah { if (skip_blah != "true") { ## deploy generic # transfer generic data file { "/var/blah/blah_v2": path => "/var/blah/blah_v2", owner => blah, group => blah, mode => 775, recurse => true, source => "puppet:///blah/blah_v2_generic", } ## choose by OS for specific case $operatingsystem { redhat: { file { "/var/blah/blah_v2_linux/etc": # no good path => "/var/blah/blah/etc", owner => blah, group => blah, mode => 775, # no good recurse => true, # no good source => "puppet:///blah/ blah_v2_linux/etc", source => [ "puppet:///blah/blah_v2_linux/etc/blahsys.sh", "puppet:///blah/blah_v2_linux/etc/blahsys.local", ] } } } } } with the "no good"s being replaced by the alternate "source => [...]" statement . Is there a more dynamic way of doing this? Cheers chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I think i''m deluding myself more than usually.... that above example should not work, because it matches my code, but the error message: err: //Node[puppetslave.example.org]/defaultnode/shared-default/ bigbrother/File[/var/bb/bbc1.9e-btf_linux/etc]/ensure: change from absent to file failed: Could not set file on ensure: No such file or directory - /var/bb/bbc1.9e-btf_linux/etc.puppettmp at /var/lib/puppet/ modules/bigbrother/manifests/init.pp:69 sadly makes sense. I must have not been doing something else right when it was "working"... chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ok, i've got a working workaround, but is there a neater way: class blah { if (skip_blah != "true") { ## deploy generic # transfer generic data file { "/var/blah/blah_v2": path => "/var/blah/blah_v2", owner => blah, group => blah, mode => 775, recurse => true, source => "puppet:///blah/blah_v2_generic", } ## choose by OS for specific case $operatingsystem { redhat: { file { "/var/blah/blah_v2_linux/etc": path => "/var/blah/blah/ linux_etc", owner => blah, group => blah, mode => 775, recurse => true source => "puppet:///blah/ blah_v2_linux/etc", require => file["/var/blah/ blah_v2"] } exec { "/bin/mv linux_etc/* etc/ && rmdir linux_etc": cwd => "/var/blah/blah", require => file["/var/blah/ blah_v2_linux/etc"], } } } } } cheers chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello again Another day another thing i haven''t done before :) I realize that i''ve got that workaround above, but i really don''t want to have to do this, the reason being: i have scripts in /opt/sbin , they are deployed as part of the install, and other users deploy service scripts for locally created things there. I want to manage some of those scripts using puppet, but i do not want to specify each script. I also don''t want to copy the files to a temporary location and then move them into place (see work around). There must be a way, and i have yet to find anything in the doco that hints at how (i''m thinking ensure might go towards it, but i''m not certain how ...) Cheers chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ensure => [ directory, present], seems to do the trick file { "/var/bb/$bbVersion.linux/etc": # changed path => "/var/bb/bb/ linux_etc", path => "/var/bb/bb/etc", owner => bb, group => bb, mode => 775, recurse => true, source => "puppet:/// bigbrother/$bbVersion.linux/etc", require => file["/var/bb/bb"], ignore => ".svn", # added: ensure => [ directory, present ], } # replaced by the above # exec # { "/bin/mv linux_etc/* etc/ && rmdir linux_etc": # cwd => "/var/bb/bb/", # require => file["/var/bb/ $bbVersion.linux/etc"], # } cheers chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
This seems much better to me. Specify what you want directly. Is there ever going to be more than one file that could collide? You probably only need the $bbVersion in the source param that way you can use one name and get rid of the path. On Sun, Feb 1, 2009 at 11:02 PM, chakkerz <chakkerz@gmail.com> wrote:> > ensure => [ directory, present], > seems to do the trick > > file > { "/var/bb/$bbVersion.linux/etc": > # changed path => "/var/bb/bb/ > linux_etc", > path => "/var/bb/bb/etc", > owner => bb, > group => bb, > mode => 775, > recurse => true, > source => "puppet:/// > bigbrother/$bbVersion.linux/etc", > require => file["/var/bb/bb"], > ignore => ".svn", > # added: > ensure => [ directory, > present ], > } > > # replaced by the above > # exec > # { "/bin/mv linux_etc/* etc/ && rmdir > linux_etc": > # cwd => "/var/bb/bb/", > # require => file["/var/bb/ > $bbVersion.linux/etc"], > # } > > cheers > chakkerz > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yeah, looks like it works a treat. The collision occurs on the container (the directory) not the files. I guess if there is a file collision, then the second file will win, because of the require =>s It took a while for the source param bit to get through, but that''s a good idea ... reduces typos :) Thanks for that, chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Jan 29, 2009, at 4:15 PM, chakkerz wrote:> > Hello there > > I''m deploying a program which has generic and OS specific (as well as > architecture, but that''s a minor issue). So in essence i''m deploying > from blah_generic/etc recursive and then blah_linux/etc . I need the > files from both operations, but was hitting some snags (I''ve found a > work around):As a general rule, I highly recommend against doing recursive file copies into /etc, except in rare cases where all copied files are related to the same service (e.g., copying into /etc/ssh). Instead, I recommend each file be copied by the service that uses the file. You get a couple of wins for doing this: * Your configuration file metadata is collocated with your service metadata (i.e., they''re all specified in the same file) * Puppet''s modules allow you to actually put the manifest and configuration file in the same module, making it easier to introspect * You don''t have cross-cutting concerns where multiple services need to care about how files are copied down. If you make a service module for most/all of your configuration files, and then create classes around them to do the deployment, I think you''ll find it''s much easier to maintain. Yes, it''s a bit more work up front, but much less in the long term. -- Ours is the age that is proud of machines that think and suspicious of men who try to. -- H. Mumford Jones --------------------------------------------------------------------- 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 -~----------~----~----~----~------~----~------~--~---
Heh, yeah, doing that sort of things (recurse into /etc) seems dangerous. What i''m using this for though is to merge the bb config that is generic and the one that is OS dependent. Also i use it to deploy some files into /opt/sbin. Thanks for your thoughts though :) i''ll keep them in mind chakkerz --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---