Created
November 12, 2009 18:54
-
-
Save jtimberman/233169 to your computer and use it in GitHub Desktop.
Example of chef 0.8.0 search and parsing results in a template
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
<%- @app_servers.each do |app| %> | |
server <%= app['hostname'] %> <%= app['ipaddress'] %>:80 | |
<%- end %> |
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
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") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment