If you want to interact with the chef server using the chef gem, you can get an interactive console using knife exec. This can be useful when trying out ideas for automation.
For example, how do I get the IP for a single (random) node for a role (example requires that pry is available):
$> bundle exec knife exec -E "require 'pry'; binding.pry"
[1] pry(#<Object>)> search(:node, 'role:solr-search').shuffle.first.ipaddress
=> "10.45.10.189"