Skip to content

Instantly share code, notes, and snippets.

@vinyar
Created March 25, 2015 13:02
Show Gist options
  • Save vinyar/0fa5c2d5941eed07f16f to your computer and use it in GitHub Desktop.
Save vinyar/0fa5c2d5941eed07f16f to your computer and use it in GitHub Desktop.
Creating Azure instance with Chef-Provisioning
#
# Cookbook Name:: chef-provisioning-azure
# Recipe:: default
#
# Copyright 2015, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
require 'chef/provisioning/azure_driver'
with_driver 'azure'
machine_options = {
:bootstrap_options => {
# :cloud_service_name => 'chefprovisioning', #required - old
:cloud_service_name => 'alexvcloudservice02', #required
# :storage_account_name => 'chefprovisioning', #required
:storage_account_name => 'alexvstorageacct02', #required
:vm_size => "Small", #required
:location => 'West US'#, #required
# :tcp_endpoints => '80:80' #optional
},
:image_id => 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140927-en-us-30GB', #required
# Until SSH keys are supported (soon)
:password => "chefm3t4lB/la\\" #required
}
machine 'alexvtrashbox01' do
machine_options machine_options
end
require 'chef/provisioning/azure_driver'
with_driver 'azure'
machine_options = {
:bootstrap_options => {
# :cloud_service_name => 'chefprovisioning', #required - old
:cloud_service_name => 'alexvcloudservice02', #required
# :storage_account_name => 'chefprovisioning', #required
:storage_account_name => 'alexvstorageacct02', #required
:vm_size => "Small", #required
:location => 'West US'#, #required
# :tcp_endpoints => '80:80' #optional
},
:image_id => 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_1-LTS-amd64-server-20140927-en-us-30GB', #required
# Until SSH keys are supported (soon)
:password => "chefm3t4lB/la\\" #required
}
machine 'alexv1' do
machine_options machine_options
action :destroy
end
machine 'alexvtrashbox01' do
machine_options machine_options
action :destroy
end
machine_batch do
machines search(:node, '*:*').map { |n| n.name }
action :destroy
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment