hiera resources in puppetdb

29 views
Skip to first unread message

Matt Zagrabelny

unread,
Jan 12, 2022, 2:53:43 PM1/12/22
to Puppet Users
Greetings,

I use lookup to get data out of hiera:

node some-host {
    class { 'foo':
        $bar = lookup('bar')
    }
}

I'd like to be able to query puppetdb to find out what hosts use various hiera keys.

So in the above example. Given bar return some-host.

I know I can write a parser to get the class "foo" that contains the hiera key "bar". Then using that class (foo in this case), I could query puppetdb with a class and get the host.

I know the hiera keys wouldn't show up in the facts report. I know that the hiera keys wouldn't show up in the catalog reports.

Is it possible to create a custom function like so:

my_lookup(key) {
    # somehow create a resource that I can query with puppetdb
   # and then use the real lookup:
   return lookup(key);
}

Any ideas about querying puppetdb to get used hiera keys in given hosts?

-m
Reply all
Reply to author
Forward
0 new messages