On Mar 20, 8:29 am, Peter Berghold <
salty.cowd...@gmail.com> wrote:
> OK... this is similar to something that I've been scratching my head over...
>
> Given something like
>
> @@file { "blah: ${hostname}": .... }
>
> and
>
> @@file {"foo: ${hostname}": ...}
>
> I'm going to have a bunch of exported resources
>
> On one system I want to instantiate all the "blah:" and on another "foo:"
>
> what mechanism can I use to make that happen?
>
> if I just do File <| |> I'll get everything and if I do File<| tag ==
> "blah" |> I'll miss everything... or am I missing something?
Maybe you are missing that you can set explicit tags in your resource
declarations, like so:
@@file { "blah: ${hostname}": tag = 'blah', ... }
by which you could make File<<| tag == 'blah' |>> do what you want.
Perhaps you are missing that resources automatically get tagged with
the names of the classes that declare them, and the names of the
classes that declare those, etc.. Depending on where your exported
resources are declared, you might be able to use that to power File<<|
tag == 'mymodule::myclass' |>>.
It could be that you are missing that defined type instances can be
exported just like any other resource, so that you could also do
define blah () {
file { "/etc/blah/${name}": ... }
}
@@blah { "${hostname}": }
...
Blah<<| |>>
None of that is intended to say that regex matching in the collection
predicate wouldn't be useful, but there are plenty of ways to be
selective about what resources get collected.
John