I am bootstrapping EC2 ubuntu instances using chef-provisioning. I can create multiple machines and create a new ELB and attach the machines to the ELB. But I am looking for ELB's information at chef server. I am using open source chef server, not the hosted chef server.
Is it possible to populate the ELB's information on Chef-server, I have to use the A record of the ELB in the templates.
require 'chef/provisioning/aws_driver'
with_driver 'aws::ap-southeast-1'
ruby_block 'get_elb' do
block do
load_balancer "test-elb" do
machines [ "machine1", "machine2" ]
load_balancer_options({
:availability_zones => "ap-southeast-1a",
listeners: [
{
instance_port: 80,
protocol: 'HTTP',
instance_protocol: 'HTTP',
port: 80
}
]
})
end
end
end
You can use the aws_object
accessor to get the underlying ELB data in a ruby_block
and write it into the provisioner node's attributes (or maybe store it in a data bag, but that is a gross and brittle solution so tread lightly).