Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of chef 0.8.0 search and parsing results in a template
<%- @app_servers.each do |app| %>
server <%= app['hostname'] %> <%= app['ipaddress'] %>:80
<%- end %>
app_servers = search(:node, 'role:webserver')
template "/etc/proxy.cfg" do
source "proxy.cfg.erb"
variables :app_servers => app_servers[0]
notifies :restart, resources(:service => "proxy")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment