Slide 25
Slide 25 text
require 'chef/knife'
require 'chef/search/query'
Capistrano::Configuration.instance.load do
Chef::Knife.new.configure_chef
def chef_role(name, query = "*:*", options = {})
attr = options.delete(:attribute) || :ipaddress
nodes = Chef::Search::Query.new.search(:node, query)
[0].map {|n| n[attr] }
role name, *nodes, options
nodes
end
end
https://github.com/cramerdev/capistrano-chef