| This ticket was implemented in a number of other PUP tickets, so I'm going to close this, and summarize the current behavior below: Facts (just the names and values) are shown in JSON by default:
# puppet facts show |
{ |
"os": { |
"release": { |
"full": "7.2", |
"major": "7", |
"minor": "2" |
}, |
... |
}
|
A subtree can be requested using dotted notation:
# puppet facts show os.release |
{ |
"os.release": { |
"full": "7.2", |
"major": "7", |
"minor": "2" |
} |
}
|
A single fact value can be requested (note due to PUP-10861 the fact value is quoted when it shouldn't be):
# puppet facts show os.release.full --value-only |
"7.2"
|
It's also possible to render the output as "flat" which is easier to parse by external automation. To Reid Vandewiele's point, this uses the existing "--render-as" puppet CLI argument rather than --flat:
# puppet facts show os.release --render-as flat |
os.release.full=7.2 |
os.release.major=7 |
os.release.minor=2
|
Puppet is not consistent about --render-as, --format, --to_yaml, but that's a different issue. |