Thanks for the response Joseph - that does help that you had the same situation. That was the only solution I could think of, I was just hoping there was some other way. I’m going to guess it is something to do with scoping of how the catalog is compiled, but I don’t know enough about the puppet internals to say that with authority.
On Jan 14, 2014, at 3:33 PM, Joseph Swick <[email protected]> wrote: > On 01/14/2014 05:12 PM, Justin Lambert wrote: >> I’m attempting to create a bunch of symlinks based on an array of filenames >> but I can’t figure out how to use the title of the resource within the >> resource itself. >> >> class app::config { >> file { [ 'a.conf', 'b.conf' ]: >> ensure => 'link', >> path => "/etc/app/${name}", >> target => "/usr/app/${name} >> } >> } >> $name and $title both equal app::config in this example. Is what I’m trying >> to do possible? >> >> I’m running puppet 3.4.0. >> >> Thanks, >> Justin >> > > It is, but you have to use a define (or at least how I'm doing it uses a > define), here's an example based on something thing I'm doing: > > common.pp: > class my_module::common () { > ... > > my_module::common::my_symlinks { ['file1', 'file2', 'file3']: } > > ... > } > > common/my_symlinks.pp: > define my_module::common::my_symlinks: { > file { "symlink_${name}": > ensure => link, > path => "/some/path/${name}", > target => "/some/other/path/${name}", > } > } > > I wasn't the first to figure that out, I think I remember who I got it > from, but I'm not sure if it's something they came up with or if they > got it from somewhere else. Hope that helps. > > -- > Joseph Swick <[email protected]> > Operations Engineer > Meltwater Group > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/855CDE79-A6B1-48A2-A7E2-E7A2A21E2BFB%40infiniteviewtech.com. For more options, visit https://groups.google.com/groups/opt_out.
