This might be obvious. However, after searching through facter's help, puppetlab's website, and Google I am still unable to figure out how to retrieve a nested facter fact .
For example, I can do:
>facter os
{"release"=>{"major"=>"6", "minor"=>"7", "full"=>"6.7"}, "family"=>"RedHat", "name"=>"CentOS"}
How do I retrieve os['name']
or os['release']['minor']
or any arbitrary nested fact via command line with facter?
Best Answer
Nested fact values can be viewed in the CLI by using a dot between variables
e.g. to retrieve
os['release']['minor']
in the CLI type:facter os.release.minor
EDIT: Apperently this only works with facter 3.x.
This doc gives a brief mention on how to access these structured (aka nested) facts (http://docs.puppetlabs.com/facter/3.1/core_facts.html):
Unfortunately I cannot find information about accessing nested facts using older versions.
In facter v3 you can do the following:
.
.