[chef] Delaying evaluation in chef provisioning script to pass dynamically assigned IDs


Chronological Thread 
  • From: Christine Draper < >
  • To:
  • Subject: [chef] Delaying evaluation in chef provisioning script to pass dynamically assigned IDs
  • Date: Thu, 29 Jan 2015 20:41:59 -0600

Apologies for more than one question in one day but I am really stuck on this one.

I am working on a chef provisioning script that sets up a subnet and then creates a machine in it.

I want to do something like this to tell chef to provision the machine in the subnet it has just created. I need to delay querying the data bag until converge time, but I can't figure out how to do it.

with_machine_options :bootstrap_options => {
  :key_name => 'xxxx',
  :instance_type => 't1.micro',
  :subnet => data_bag_item("aws_subnet", "subnet-a")["subnet_id"],
  :associate_public_ip_address => true
}

I have a similar problem later when I need to pass an IP address from one machine to another, and I need the 'attribute' to be evaluated at converge time:

machine 'db' do
  run_list ['apt','automateinsights::db']
end

machine 'appserver' do
 run_list ['automateinsights::deploy_from_package']
 attribute  ['automateinsights', 'envconfig', 'db_location'], need db ipaddress here
end

Regards,
Christine



Archive powered by MHonArc 2.6.16.

§