Created
June 14, 2010 22:56
-
-
Save spidaman/438446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'chef/node' | |
require 'chef/rest' | |
# set chef_server_url and node_name & get the path to key file | |
# look in ~/.chef/knife.rb | |
Chef::Config[:client_key] = "/path/to/key" | |
rest = Chef::REST.new(chef_server_url, node_name) | |
results = rest.get_rest("search/node?q=role:WEBSERVER_ROLE") | |
# got search meta data, an array of nodes is under the 'rows' key | |
nodes = results['rows'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment