On Wednesday, May 8, 2013 9:09:34 AM UTC-4, jcbollinger wrote: > > > > On Wednesday, May 8, 2013 5:52:44 AM UTC-5, Bret Wortman wrote: >> >> What's the right/best way to indicate that a particular entry in a >> manifest (a file in this case) depends on successful installation of over >> 30 packages, all indicated in the same manifest? > > > > What is the significance to you of the packages being in the same > manifest? To Puppet, it matters very little. Do you mean they are in the > same class? Or could they be made to be? >
They are in the same class, actually. I wasn't clear enough -- wrote this before my coffee kicked in. > > > >> I could do this, but it seems cumbersome: >> >> package { 'pkg1': } >> Package['pkg1'] -> File['file1'] >> >> package { 'pkg2': } >> Package['pkg2'] -> File['file2'] >> : >> : >> file { 'file2': >> path => '/path/to/file2', >> : >> } >> >> > > You've confused me a bit there. Your question suggests that you want a > single file depending on all the packages, but the example looks like you > may mean multiple files, each depending on one package. Or maybe not. I > am proceeding based on the question rather than on the ambiguous example. > Blaming coffee again. The "file2" is a typo. All the right-hand sides should read ' -> File["file1"]'. > > > >> There must be a better way that I'm just not seeing. Thanks! >> >> > There is a variety of ways. If the packages are all in the same class, > and File['file2'] is in a different one, then you can declare the file this > way: > > file { '/path/to/file2': > require => Class['mymodule::manypackages'] > } > > Alternatively, you can use tags to recognize the packages in question, and > write the relationship like this: > > Package<| tag == '<some-tag>' |> -> File['/path/to/file2'] > > Tag 'some-tag' could be explicitly declared on the Packages, or under some > circumstances it would work to just use the class name (which is > automatically included in resources' tags). With explicitly declared tags, > this can work even when the packages are in different classes or even not > in classes at all. > > Or you can perhaps use resource defaults for this. That's more brittle > and more susceptible to unintended relationships, but it's easy to set up. > To do that, put this at the top of the body of the class(es) that declare > the packages: > > include <class-of-file2-if-different> > > Package { > before => File['/path/to/file2'] > } > > There are other alternatives, too. > Okay, so if the class actually looks like this, say: class blacklisted () { Package { ensure => absent, tag => "blacklisted", } package { 'pkg1': } package { 'pkg2': } package { 'pkg3': } : package { 'pkg30': } file { '/path/to/file1': ensure => present, } Package<| tag == 'blacklisted' |> -> File['/path/to/file1'] } Should do it, right? I've never done anything with tags before, but this may cause me to rework a few modules I've written.... > > > John > > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.