I'm not sure of the utility of this, but maybe it'll be useful to someone else. I was requested to output all the facts from a system in xml, not wanting to type much I made the following script...
#!/usr/bin/env rubyrequire 'facter'
require 'rubygems'
require 'activesupport'Facter.loadfacts
facts = {}for fact in Facter.list.sort
facts[fact] = Facter.value(fact)
endxml = facts.to_xml(:root => "facts")
print xml
The output looks like the following:
<?xml version="1.0" encoding="UTF-8"?>13139767
...
4
lmnbsd01094d02127.0.0.0
Tikanga
x86_64
Possibly useful someday...I require activesupport, so you'll need to install that gem. That gem gives you the to_xml method for hashes.
Enjoy.