Created
September 16, 2014 14:28
-
-
Save behemphi/8959c3ae0fb3cb583394 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# If this is a large instance we need to locate the database host. | |
if node.chef_environment.include?('large') | |
nodes = search(:node, "name:#{node.foobar.instance_name}*") | |
log "nodes found: #{nodes.count()}" | |
# Looking for the database host | |
nodes.each do |n| | |
# If the database host exists, get its servicenet IP, otherwise fail | |
# the run. | |
if n.name.index('-db') | |
node.set['foobar']['db']['host_ip'] = n.cloud.private_ips[0] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment