Last active
August 29, 2015 14:09
-
-
Save charlesjohnson/a8b884c1ffb7d585657c to your computer and use it in GitHub Desktop.
Chef Provisioning Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat /Users/charlesjohnson/.chef/local-mode-cache/cache/chef-stacktrace.out | |
Generated at 2014-11-16 22:22:42 -0800 | |
NoMethodError: machine_batch[default] (@recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb line 18) had an error: NoMethodError: undefined method `location' for nil:NilClass | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:353:in `block in parse_multi_vagrant_up' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:347:in `each' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:347:in `parse_multi_vagrant_up' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:306:in `block in start_machines' | |
/opt/chefdk/embedded/apps/chef/lib/chef/mixin/why_run.rb:52:in `call' | |
/opt/chefdk/embedded/apps/chef/lib/chef/mixin/why_run.rb:52:in `add_action' | |
/opt/chefdk/embedded/apps/chef/lib/chef/provider.rb:156:in `converge_by' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.16.1/lib/chef/provisioning/chef_provider_action_handler.rb:54:in `perform_action' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:300:in `start_machines' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-vagrant-0.8.1/lib/chef/provisioning/vagrant_driver/driver.rb:123:in `ready_machines' | |
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.16.1/lib/chef/provider/machine_batch.rb:94:in `block in with_ready_machines' | |
/opt/chefdk/embedded/apps/chef/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb:267:in `call' | |
/opt/chefdk/embedded/apps/chef/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb:267:in `process_input' | |
/opt/chefdk/embedded/apps/chef/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb:257:in `process_one' | |
/opt/chefdk/embedded/apps/chef/lib/chef/chef_fs/parallelizer.rb:93:in `call' | |
/opt/chefdk/embedded/apps/chef/lib/chef/chef_fs/parallelizer.rb:93:in `worker_loop'% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current_dir = File.dirname(__FILE__) | |
log_level :info | |
log_location STDOUT | |
node_name "opscode" | |
client_key "#{current_dir}/mykey.pem" | |
validation_client_name "myorg-validator" | |
validation_key "#{current_dir}/myorg-validator.pem" | |
chef_server_url "https://chef.chef-demo.com/organizations/myorg" | |
cache_type 'BasicFile' | |
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" ) | |
cookbook_path ["#{current_dir}/../chef-repo/vendor/cookbooks"] | |
chef_repo_path ["#{current_dir}/../chef-repo"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# myapp_stack.rb | |
# Chef Provisioning, Y'all | |
require 'chef/provisioning' | |
# Number of webservers we want | |
num_webservers = 2 | |
# Create our array of hosts | |
hosts = %w(dbserver balancer) | |
1.upto(num_webservers) do |i| | |
hosts << "web#{i}" | |
end | |
# Iterate each host, offset the index starting at 18 to generate IP addresses | |
# and run base setup in first converge | |
machine_batch do | |
hosts.each.with_index(18) do |hostname, ip| | |
machine hostname do | |
add_machine_options :vagrant_options => { | |
'vm.hostname' => "#{hostname}.chef-demo.com" | |
}, :vagrant_config => <<-EOM | |
config.vm.network :private_network, ip: '192.168.243.#{ip}' | |
EOM | |
chef_environment 'production' | |
run_list [ | |
'recipe[ohai_plugins::vagrant_ipaddress]', | |
'role[ubuntu_base]' | |
] | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2014-11-16T22:21:56-08:00] INFO: Forking chef instance to converge... | |
Starting Chef Client, version 11.16.4 | |
[2014-11-16T22:21:57-08:00] INFO: *** Chef 11.16.4 *** | |
[2014-11-16T22:21:57-08:00] INFO: Chef-client pid: 39031 | |
[2014-11-16T22:21:59-08:00] INFO: HTTP Request Returned 404 Not Found : Object not found: http://localhost:8889/nodes/opscode | |
[2014-11-16T22:21:59-08:00] INFO: Run List is [] | |
[2014-11-16T22:21:59-08:00] INFO: Run List expands to [] | |
[2014-11-16T22:21:59-08:00] INFO: Starting Chef Run for opscode | |
[2014-11-16T22:21:59-08:00] INFO: Running start handlers | |
[2014-11-16T22:21:59-08:00] INFO: Start handlers complete. | |
[2014-11-16T22:21:59-08:00] INFO: HTTP Request Returned 404 Not Found : Object not found: /reports/nodes/opscode/runs | |
resolving cookbooks for run list: [] | |
[2014-11-16T22:21:59-08:00] INFO: Loading cookbooks [] | |
Synchronizing Cookbooks: | |
Compiling Cookbooks... | |
WARN: Unresolved specs during Gem::Specification.reset: | |
nokogiri (>= 1.4.0, ~> 1.5) | |
WARN: Clearing out unresolved specs. | |
Please report a bug if this causes problems. | |
[2014-11-16T22:22:00-08:00] WARN: Node opscode has an empty run list. | |
Converging 5 resources | |
Recipe: @recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/vagrant_driver.rb | |
* vagrant_box[chef/centos-6.5] action create[2014-11-16T22:22:00-08:00] INFO: Processing vagrant_box[chef/centos-6.5] action create (@recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/vagrant_driver.rb line 3) | |
(up to date) | |
Recipe: @recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb | |
* machine_batch[default] action converge[2014-11-16T22:22:01-08:00] INFO: Processing machine_batch[default] action converge (@recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb line 18) | |
[2014-11-16T22:22:01-08:00] INFO: HTTP Request Returned 404 Not Found : Object not found: http://localhost:8889/nodes/dbserver | |
[2014-11-16T22:22:01-08:00] INFO: Processing vagrant_cluster[/Users/charlesjohnson/.chef/vms] action create (basic_chef_client::block line 212) | |
[2014-11-16T22:22:01-08:00] INFO: Processing directory[/Users/charlesjohnson/.chef/vms] action create (basic_chef_client::block line 15) | |
[2014-11-16T22:22:01-08:00] INFO: Processing file[/Users/charlesjohnson/.chef/vms/Vagrantfile] action create (basic_chef_client::block line 16) | |
[2014-11-16T22:22:01-08:00] INFO: file[/Users/charlesjohnson/.chef/vms/Vagrantfile] created file /Users/charlesjohnson/.chef/vms/Vagrantfile | |
- [dbserver] create new file /Users/charlesjohnson/.chef/vms/Vagrantfile[2014-11-16T22:22:01-08:00] INFO: file[/Users/charlesjohnson/.chef/vms/Vagrantfile] updated file contents /Users/charlesjohnson/.chef/vms/Vagrantfile | |
- [dbserver] update content in file /Users/charlesjohnson/.chef/vms/Vagrantfile from none to 0ea456 | |
- [dbserver] --- /Users/charlesjohnson/.chef/vms/Vagrantfile 2014-11-16 22:22:01.000000000 -0800 | |
- [dbserver] +++ /var/folders/h6/nblxznwx11sdd4c54hd2923w0000gp/T/.Vagrantfile20141116-39031-1c5vuze 2014-11-16 22:22:01.000000000 -0800 | |
- [dbserver] @@ -1 +1,4 @@ | |
- [dbserver] +Dir.glob('/Users/charlesjohnson/.chef/vms/*.vm') do |vm_file| | |
- [dbserver] + eval(IO.read(vm_file), nil, vm_file) | |
- [dbserver] +end[2014-11-16T22:22:01-08:00] INFO: Processing file[/Users/charlesjohnson/.chef/vms/dbserver.vm] action create (basic_chef_client::block line 232) | |
[2014-11-16T22:22:01-08:00] INFO: file[/Users/charlesjohnson/.chef/vms/dbserver.vm] created file /Users/charlesjohnson/.chef/vms/dbserver.vm | |
- [dbserver] create new file /Users/charlesjohnson/.chef/vms/dbserver.vm[2014-11-16T22:22:01-08:00] INFO: file[/Users/charlesjohnson/.chef/vms/dbserver.vm] updated file contents /Users/charlesjohnson/.chef/vms/dbserver.vm | |
- [dbserver] update content in file /Users/charlesjohnson/.chef/vms/dbserver.vm from none to a6a190 | |
- [dbserver] --- /Users/charlesjohnson/.chef/vms/dbserver.vm 2014-11-16 22:22:01.000000000 -0800 | |
- [dbserver] +++ /var/folders/h6/nblxznwx11sdd4c54hd2923w0000gp/T/.dbserver.vm20141116-39031-sisfa2 2014-11-16 22:22:01.000000000 -0800 | |
- [dbserver] @@ -1 +1,8 @@ | |
- [dbserver] +Vagrant.configure('2') do |outer_config| | |
- [dbserver] + outer_config.vm.define "dbserver" do |config| | |
- [dbserver] + config.vm.hostname = "dbserver.chef-demo.com" | |
- [dbserver] + config.vm.box = "chef/ubuntu-12.04" | |
- [dbserver] + config.vm.network :private_network, ip: '192.168.243.18' | |
- [dbserver] + end | |
- [dbserver] +end[2014-11-16T22:22:01-08:00] INFO: Processing chef_node[dbserver] action create (basic_chef_client::block line 65) | |
[2014-11-16T22:22:01-08:00] INFO: HTTP Request Returned 404 Not Found : Object not found: http://localhost:8889/nodes/dbserver | |
- [dbserver] create node dbserver at http://localhost:8889 | |
- [dbserver] update chef_environment from "_default" to "production" | |
- [dbserver] add normal.tags = nil | |
- [dbserver] add normal.chef_provisioning = {"location"=>{"driver_url"=>"vagrant:/Users/charlesjohnson/.chef/vms", "driver_version"=>"0.8.1", "vm_name"=>"dbserver", "vm_file_path"=>"/Users/charlesjohnson/.chef/vms/dbserver.vm", "allocated_at"=>"2014-11-17 06:22:01 UTC", "host_node"=>"http://localhost:8889/nodes/", "needs_reload"=>true}} | |
- [dbserver] update run_list from [] to ["recipe[ohai_plugins::vagrant_ipaddress]", "role[ubuntu_base]"] | |
================================================================================ | |
Error executing action `converge` on resource 'machine_batch[default]' | |
================================================================================ | |
NoMethodError | |
------------- | |
undefined method `location' for nil:NilClass | |
Resource Declaration: | |
--------------------- | |
# In /Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb | |
18: machine_batch do | |
19: machine hostname do | |
20: add_machine_options :vagrant_options => { | |
21: 'vm.hostname' => "#{hostname}.chef-demo.com" | |
22: }, :vagrant_config => <<-EOM | |
23: config.vm.network :private_network, ip: '192.168.243.#{ip}' | |
24: EOM | |
25: chef_environment 'production' | |
26: run_list [ | |
27: 'recipe[ohai_plugins::vagrant_ipaddress]', | |
28: 'role[ubuntu_base]' | |
29: ] | |
30: end | |
31: end | |
32: end | |
Compiled Resource: | |
------------------ | |
# Declared in /Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb:18:in `block in from_file' | |
machine_batch("default") do | |
action :converge | |
retries 0 | |
retry_delay 2 | |
guard_interpreter :default | |
driver "vagrant" | |
chef_server {:chef_server_url=>"http://localhost:8889", :options=>{:client_name=>"opscode", :signing_key_filename=>"/Users/charlesjohnson/Development/demo-framework/.chef/opscode.pem"}} | |
machine_options {:vagrant_options=>{"vm.box"=>"chef/ubuntu-12.04"}} | |
cookbook_name "@recipe_files" | |
recipe_name "/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb" | |
machines ["dbserver"] | |
end | |
[2014-11-16T22:22:42-08:00] INFO: Running queued delayed notifications before re-raising exception | |
Running handlers: | |
[2014-11-16T22:22:42-08:00] ERROR: Running exception handlers | |
Running handlers complete | |
[2014-11-16T22:22:42-08:00] ERROR: Exception handlers complete | |
[2014-11-16T22:22:42-08:00] FATAL: Stacktrace dumped to /Users/charlesjohnson/.chef/local-mode-cache/cache/chef-stacktrace.out | |
Chef Client failed. 0 resources updated in 45.407163 seconds | |
[2014-11-16T22:22:42-08:00] ERROR: machine_batch[default] (@recipe_files::/Users/charlesjohnson/Development/demo-framework/chef-repo/cookbooks/df-provisioning/recipes/app_stack.rb line 18) had an error: NoMethodError: undefined method `location' for nil:NilClass | |
[2014-11-16T22:22:42-08:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vagrant_driver.rb | |
require 'chef/provisioning/vagrant_driver' | |
vagrant_box 'chef/centos-6.5' | |
with_machine_options :vagrant_options => { | |
'vm.box' => 'chef/ubuntu-12.04' | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment