Hi All,
Following a small discussion yesterday on IRC of how to use the query
interface library, here is an example:
#! /usr/bin/ruby
require 'foreman'
hosts = gethosts({"fact"=>{"domain"=>"lan", "puppetversion"=>"0.25.4"}})
if hosts.nil?
puts "no hosts found"
else
puts hosts.join(" ")
end
the gethosts also supports classes and state, e.g:
hosts = gethosts({"fact"=>{"kernel"=>"Linux",
"puppetversion"=>"0.24.8"}, "class" => "base", "state" => "all"})
Ohad