Chef Provisioning With Azure

I’m currently using Chef Provisioning to build clusters in vRa and it works great. We are now testing the provisioning in Azure and I am having issues just trying to run a simple cookbook to create 1 vm with the ‘chef/provisioning/azure_driver’ driver. I’m able to actually get the VM built, but the end results is an error…

This is the error …

Chef Client finished, 1/1 resources updated in 01 minutes 59 seconds

Running handlers:
[2016-05-12T10:26:40-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-05-12T10:26:40-05:00] ERROR: Exception handlers complete
Chef Client failed. 1 resources updated in 01 minutes 59 seconds
[2016-05-12T10:26:40-05:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook @recipe_files not found. If you''re loading @recipe_files from another
cookbook, make sure you configure the dependency in your metadata

Here is my recipe, which is the default…

require 'chef/provisioning/azure_driver'
with_driver 'azure'

chefserver = <<-EOS
-----BEGIN CERTIFICATE-----
[encrypted_cert]
-----END CERTIFICATE-----
EOS

machine_options = {
    :bootstrap_options => {
      :vm_user => 'localadmin', #required if Windows
      :cloud_service_name => 'kmchefprovisioning2', #required
      :storage_account_name => 'kmchefprovisioning', #required
      :vm_size => 'Standard_D1', #optional
      :location => 'Central US', #optional
      :tcp_endpoints => '3389:3389', #optional
      :winrm_transport => { #optional
        'https' => { #required (valid values: 'http', 'https')
          :disable_sspi => false, #optional, (default: false)
          :basic_auth_only => false, #optional, (default: false)
          :no_ssl_peer_verification => true #optional, (default: false)
        }
      }
    },
    :password => 'P2ssw0rd', #required
    :image_id => 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20160430-en.us-127GB.vhd' #required				
}


machine 'toad2' do
  machine_options machine_options
	files 'C:/chef/trusted_certs/mlvpsmng20.consilio.com.pem' => {
						content: chefserver
					}
end

additinally, the cluster that I will be needing to run can create as many as 70 VMs, we are using the machine_batch resource and I’m not sure how to apply that here becasue I tried to wrap the machine options within the machine resource and i got errors and it referenced an ubuntu image, which was super wierd…

Thanks!!

I’ve tested this further and it seems that even though I get that FATAL error at the end, the recipes are complete and all is well. So can anyone explain why I’m getting this error?

Hey kxmoss - are you running with the latest version of the ChefDK (0.13)? I have seen that error before but it is pretty ubiquitous and can have many causes.

I’m not personally familiar with chef-provisioning-azure but I know that chef-provisioning-azurerm has had more recent development. Have you tried using that?

I’m actually using 0.11.2, which was the latest when I began this provisioning journey lol…and we plan on testing the ARM resource as well…I am updating my chefDK now to see if the error goes away.

The good news is, I was able to bring up a web cluster with my code pretty much the way it is, just the final result shows that same fatal error, but all VMs are up and expected software updates and configuration have been applied…

If anyone is interested in how I’m accomplishing this so far, here is what the provisioning recipe looks…the attribute is actually kicking off a different recipe to do some web server configurations that I need set…

require 'chef/provisioning/azure_driver'
with_driver 'azure'

chefserver = <<-EOS
-----BEGIN CERTIFICATE-----
[encrypted_certificate]
-----END CERTIFICATE-----
EOS

with_chef_server(
  'https://[CHEF_SERVER].cloudapp.net/organizations/consilio_devops',
  client_name: Chef::Config[:node_name],
  signing_key_filename: Chef::Config[:client_key]
) do
	machine_batch do
		1.upto(3) do |i|
			machine "web#{i}" do
				machine_options :bootstrap_options => {
					:vm_user => 'localadmin', #required if Windows
					:cloud_service_name => "kmprovisioningweb#{i}", #required
					:storage_account_name => "kmchefprovisioning#{i}", #required
					:vm_size => 'Standard_D1', #optional
					:location => 'Central US', #optional
					:tcp_endpoints => '3389:3389', #optional
					:winrm_transport => { #optional
						'https' => { #required (valid values: 'http', 'https')
							:disable_sspi => false, #optional, (default: false)
							:basic_auth_only => false, #optional, (default: false)
							:no_ssl_peer_verification => true #optional, (default: false)
						}
					},
					convergence_options: {
							chef_version: '12.9.41'
						}
				},
				:password => 'P2ssw0rd', #required
				:image_id => 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20160430-en.us-127GB.vhd' #required
				
				files 'C:/chef/trusted_certs/CERTIFICATE.consilio.com.pem' => {
					content: chefserver
				}
				run_list ['cookbook-azure_testing']
				
				attribute %w(Provisioning Web Setup), 1
			end
		end
	end
end