Ask Your Question

Can custom facts use values from external facts?

asked 2017-08-09 13:12:13 -0500

Is there a way to tell facter to load external facts before custom facts? I want to be able to use external facts from a yaml file with Facter.value(), but the fact doesn't exist until after my custom fact ruby code is loaded. thanks! -james

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-08-09 16:16:59 -0500

updated 2017-08-09 16:17:47 -0500

Ok, I found a way around this. Possibly there's a better way, but you can pretty easily load a yaml file into ruby code and use it in a custom fact library.

external_facts = YAML.load_file('/etc/facter/facts.d/external_facts.yaml')

Then, in ruby code you can just reference the external_facts hash table to get whatever parameter is needed. It seems like there should probably be a cleaner way to do this and hopefully someone else will reply. But, on the chance that there isn't, maybe this will help someone else.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-08-09 13:12:13 -0500

Seen: 9 times

Last updated: Aug 09