Facts are loaded, and distributed from the master, before the catalog
compilation step. See
https://docs.puppet.com/facter/3.3/custom_facts.html#external-facts. Rather
than distributing the json files as a File resource, you could add an
executable fact to a module and the fact could communicate with the CMDB to
gather the correct fact information.

However, I think what you really want is an External Node Classifier (
https://puppet.com/docs/puppet/5.3/nodes_external.html). Similar to a
function, it runs on the master, but unlike functions it happens before
catalog compilation, so the hash of key/values it returns can be used
during catalog compilation. That seems like the perfect fit for your use
case, except ENCs need to return yaml, not json.



Rob Nelson
rnels...@gmail.com

On Tue, Dec 5, 2017 at 5:13 AM, buoyant_puppy <fred.oris...@gmail.com>
wrote:

>
>
> On Friday, December 1, 2017 at 5:59:51 PM UTC+1, R.I. Pienaar wrote:
>>
>>
>> All functions like foo() run on the master during compile.  It's a multi
>> phase process, the only way a node can influence the compile time is
>> using facts.
>>
>> You could integrate your CMDB with puppet using a hiera data function
>> that could exist as a tier in your hierarchy
>>
>
> Thanks, that makes sense now. I'm looking into hiera, but I think I have
> another alternative as well. If I put my json files in the facter/facts.d
> directory (on the agent), it will be automatically loaded.
> The only somewhat minor downside is that facter runs first, so the data it
> fetches will only be available in the next puppet run.
>
> I'm not sure if that's better or worse than the hiera option as I didn't
> get hiera working yet.
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/1bbf939a-75a8-49a7-9b11-8e073b945335%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/1bbf939a-75a8-49a7-9b11-8e073b945335%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC76iT9zbxyOtdSr0EZ4Tu7Fnbxtzje-pz64K7TtSe4UzdE5NQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to