简体   繁体   English

如何从自定义厨师食谱访问opsworks elb层ip

[英]How can I access opsworks elb layer ip from custom chef recipes

I am trying to access the elb ip address from other layers in my chef recipes to write to a conf file in multiple instances. 我正在尝试从我的厨师食谱中的其他层访问elb ip地址,以在多个实例中写入conf文件。

node[:opsworks][:layers][:layer_name][:instances][:instance_name] 节点[:opsworks] [:层] [:LAYER_NAME] [:实例] [:INSTANCE_NAME]

only returns the app instances and not the elb address fronting them 仅返回应用程序实例,而不返回它们前面的Elb地址

After reading more of the documentation( http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json.html#workingcookbook-json-obtain ), I figured out that I could look at my chef stack configuration and deployment json file directly once I ssh'd into a machine. 阅读更多文档( http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-json.html#workingcookbook-json-obtain )后,我发现可以查看我的厨师堆栈配置和ssh放入机器后,直接部署json文件。

Once I got the file, I realized that there is a field parallel to node[:opsworks][:layers][:layer_name][:instances] called node[:opsworks][:layers][:layer_name]["elb-load-balancers"] that contains an array of objects each with a "dns_name" field name for the load balancers in that layer. 收到文件后,我意识到有一个与node [:opsworks] [:layers] [:layer_name] [:instances]平行的字段称为node [:opsworks] [:layers] [:layer_name] [“ elb-负载均衡器”],其中包含对象数组,每个对象都有该层中负载均衡器的“ dns_name”字段名称。

Hope this helps someone else in the future! 希望这对以后的人有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM