Issue with userdata with chef provisioning

I am trying to bootstrap machines using chef provision. Everything is working fine but userdata is not getting added to the machines. Below is the code I am using. Any help would be highly appreciated.

my_dbag = data_bag_item('test','test-dbagitem')    
cluster_array = my_dbag['cluster_name']    

cluster_array.each {|cluster|    
machine cluster do    
 add_machine_options bootstrap_options: {    
 subnet: my_dbag['subnet-id'],    
 image_id: my_dbag['ami-id'],    
 security_group_ids: my_dbag['security-group-ids'],    
 key_name: my_dbag['security-keypair'],    
 instance_type: my_dbag['instance-type'],    
 user_data: cluster    
 tag cluster     
ohai_hints 'ec2' => '{}'    

Source: ubuntu

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.