Okay, I'm almost there!
My goal is to have 3 mongo servers set up in a replicaset. I'm
experimenting using VirtualBox with opscode-ubuntu-1204 vm (workstation
is also Ubuntu 12.04).
Below is the code from the Vagrantfile. I think that's what I want.
(I assign different vm.hostname and ip address and chef.node_name to
each of the three servers.)
Mongo is contained in a cookbook wrapper called bti_mongo.
Mongo cookbook is retrieved via Berkshelf: cookbook 'mongodb', ">=
0.12.0", :git => 'git://github.com/edelight/chef-mongodb.git', branch:
"9049ddde9fb6017321c1c9700228add78d2cc44d"
(I tried several versions after discovering the bug introduced by change
from Chef 10 to 11.)
I've just been creating and configuring the nodes with the OpsCode
management site. There is a node named "mongo1" with the bti_mongo recipe.
Anyway, I'm not clear on whether this is a bug in the mongo recipe, or
perhaps due to some error I've made in setting things up.
Any help would be appreciated.
Liam
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.provision :shell, :inline => "echo Hello"config.vm.define :mongo1 do |m|
m.vm.box = "opscode-ubuntu-1204"
m.vm.hostname = "mongo1"
m.vm.network :private_network, ip: "10.10.10.71"
m.vm.provision :chef_client do |chef|
chef.node_name = "mongo1"
chef.chef_server_url = "Sign In - Chef Manage"
chef.validation_key_path = ".chef/bti-validator.pem"
chef.validation_client_name = "bti-validator"
end
end
Starting vm:
liam@gavilan$ vagrant up mongo1
Bringing machine 'mongo1' up with 'virtualbox' provider...
[mongo1] Setting the name of the VM...
[mongo1] Clearing any previously set forwarded ports...
[mongo1] Creating shared folders metadata...
[mongo1] Clearing any previously set network interfaces...
[mongo1] Preparing network interfaces based on configuration...
[mongo1] Forwarding ports...
[mongo1] -- 22 => 2222 (adapter 1)
[mongo1] Booting VM...
[mongo1] Waiting for VM to boot. This can take a few minutes.
[mongo1] VM booted and ready for use!
[mongo1] Setting hostname...
[mongo1] Configuring and enabling network interfaces...
[mongo1] Mounting shared folders...
[mongo1] -- /vagrant
[mongo1] Running provisioner: shell...
[mongo1] Running: inline script
stdin: is not a tty
Hello
[mongo1] Running provisioner: chef_client...
Creating folder to hold client key...
Uploading chef client validation key...
Generating chef JSON and uploading...
[mongo1] Warning: Chef solo run list is empty. This may not be what
you want.
Running chef-client...
stdin: is not a tty
[2013-05-30T07:05:03+00:00] INFO: *** Chef 11.4.4 ***
[2013-05-30T07:05:03+00:00] INFO: [inet6] no default interface,
picking the first ipaddress
[2013-05-30T07:05:03+00:00] INFO: ipaddress and ip6address are set
from different interfaces (eth0 & eth1), macaddress has been set using
the ipaddress interface
[2013-05-30T07:05:04+00:00] INFO: Client key /etc/chef/client.pem is
not present - registering
[2013-05-30T07:05:12+00:00] INFO: Run List is [recipe[bti_mongo]]
[2013-05-30T07:05:12+00:00] INFO: Run List expands to [bti_mongo]
[2013-05-30T07:05:13+00:00] INFO: Starting Chef Run for mongo1
[2013-05-30T07:05:13+00:00] INFO: Running start handlers
[2013-05-30T07:05:13+00:00] INFO: Start handlers complete.
[2013-05-30T07:05:17+00:00] INFO: Loading cookbooks [apt, bti_mongo,
mongodb, yum]
[2013-05-30T07:05:20+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/mongos.rb in the cache.
[2013-05-30T07:05:23+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/configserver.rb in the cache.
[2013-05-30T07:05:24+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/10gen_repo.rb in the cache.
[2013-05-30T07:05:25+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/default.rb in the cache.
[2013-05-30T07:05:26+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/shard.rb in the cache.
[2013-05-30T07:05:27+00:00] INFO: Storing updated
cookbooks/mongodb/recipes/replicaset.rb in the cache.
[2013-05-30T07:05:27+00:00] INFO: Storing updated
cookbooks/mongodb/definitions/mongodb.rb in the cache.
[2013-05-30T07:05:28+00:00] INFO: Storing updated
cookbooks/mongodb/libraries/mongodb.rb in the cache.
[2013-05-30T07:05:29+00:00] INFO: Storing updated
cookbooks/mongodb/attributes/default.rb in the cache.
[2013-05-30T07:05:30+00:00] INFO: Storing updated
cookbooks/mongodb/CHANGELOG in the cache.
[2013-05-30T07:05:31+00:00] INFO: Storing updated
cookbooks/mongodb/Makefile in the cache.
[2013-05-30T07:05:32+00:00] INFO: Storing updated
cookbooks/mongodb/.gitignore in the cache.
[2013-05-30T07:05:33+00:00] INFO: Storing updated
cookbooks/mongodb/NOTICE in the cache.
[2013-05-30T07:05:34+00:00] INFO: Storing updated
cookbooks/mongodb/README.md in the cache.
[2013-05-30T07:05:35+00:00] INFO: Storing updated
cookbooks/mongodb/LICENSE in the cache.
[2013-05-30T07:05:35+00:00] INFO: Storing updated
cookbooks/mongodb/metadata.rb in the cache.
[2013-05-30T07:05:36+00:00] INFO: Storing updated
cookbooks/bti_mongo/recipes/default.rb in the cache.
[2013-05-30T07:05:37+00:00] INFO: Storing updated
cookbooks/bti_mongo/CHANGELOG.md in the cache.
[2013-05-30T07:05:37+00:00] INFO: Storing updated
cookbooks/bti_mongo/README.md in the cache.
[2013-05-30T07:05:38+00:00] INFO: Storing updated
cookbooks/bti_mongo/metadata.rb in the cache.
[2013-05-30T07:05:39+00:00] INFO: Storing updated
cookbooks/apt/resources/preference.rb in the cache.
[2013-05-30T07:05:40+00:00] INFO: Storing updated
cookbooks/apt/resources/repository.rb in the cache.
[2013-05-30T07:05:44+00:00] INFO: Storing updated
cookbooks/apt/providers/preference.rb in the cache.
[2013-05-30T07:05:45+00:00] INFO: Storing updated
cookbooks/apt/providers/repository.rb in the cache.
[2013-05-30T07:05:45+00:00] INFO: Storing updated
cookbooks/apt/recipes/cacher-ng.rb in the cache.
[2013-05-30T07:05:46+00:00] INFO: Storing updated
cookbooks/apt/recipes/default.rb in the cache.
[2013-05-30T07:05:47+00:00] INFO: Storing updated
cookbooks/apt/recipes/cacher-client.rb in the cache.
[2013-05-30T07:05:47+00:00] INFO: Storing updated
cookbooks/apt/attributes/default.rb in the cache.
[2013-05-30T07:05:48+00:00] INFO: Storing updated
cookbooks/apt/Berksfile in the cache.
[2013-05-30T07:05:49+00:00] INFO: Storing updated
cookbooks/apt/TESTING.md in the cache.
[2013-05-30T07:05:50+00:00] INFO: Storing updated
cookbooks/apt/metadata.json in the cache.
[2013-05-30T07:05:51+00:00] INFO: Storing updated
cookbooks/apt/CONTRIBUTING in the cache.
[2013-05-30T07:05:51+00:00] INFO: Storing updated
cookbooks/apt/.gitignore in the cache.
[2013-05-30T07:05:52+00:00] INFO: Storing updated
cookbooks/apt/CHANGELOG.md in the cache.
[2013-05-30T07:05:53+00:00] INFO: Storing updated
cookbooks/apt/README.md in the cache.
[2013-05-30T07:05:54+00:00] INFO: Storing updated
cookbooks/apt/LICENSE in the cache.
[2013-05-30T07:05:54+00:00] INFO: Storing updated
cookbooks/apt/metadata.rb in the cache.
[2013-05-30T07:05:55+00:00] INFO: Storing updated
cookbooks/apt/.kitchen.yml in the cache.
[2013-05-30T07:05:56+00:00] INFO: Storing updated
cookbooks/yum/resources/key.rb in the cache.
[2013-05-30T07:05:57+00:00] INFO: Storing updated
cookbooks/yum/resources/repository.rb in the cache.
[2013-05-30T07:05:57+00:00] INFO: Storing updated
cookbooks/yum/providers/key.rb in the cache.
[2013-05-30T07:05:58+00:00] INFO: Storing updated
cookbooks/yum/providers/repository.rb in the cache.
[2013-05-30T07:06:04+00:00] INFO: Storing updated
cookbooks/yum/recipes/repoforge.rb in the cache.
[2013-05-30T07:06:05+00:00] INFO: Storing updated
cookbooks/yum/recipes/yum.rb in the cache.
[2013-05-30T07:06:06+00:00] INFO: Storing updated
cookbooks/yum/recipes/test.rb in the cache.
[2013-05-30T07:06:07+00:00] INFO: Storing updated
cookbooks/yum/recipes/ius.rb in the cache.
[2013-05-30T07:06:07+00:00] INFO: Storing updated
cookbooks/yum/recipes/default.rb in the cache.
[2013-05-30T07:06:08+00:00] INFO: Storing updated
cookbooks/yum/recipes/elrepo.rb in the cache.
[2013-05-30T07:06:09+00:00] INFO: Storing updated
cookbooks/yum/recipes/epel.rb in the cache.
[2013-05-30T07:06:10+00:00] INFO: Storing updated
cookbooks/yum/recipes/remi.rb in the cache.
[2013-05-30T07:06:10+00:00] INFO: Storing updated
cookbooks/yum/attributes/default.rb in the cache.
[2013-05-30T07:06:11+00:00] INFO: Storing updated
cookbooks/yum/attributes/elrepo.rb in the cache.
[2013-05-30T07:06:12+00:00] INFO: Storing updated
cookbooks/yum/attributes/epel.rb in the cache.
[2013-05-30T07:06:13+00:00] INFO: Storing updated
cookbooks/yum/attributes/remi.rb in the cache.
[2013-05-30T07:06:13+00:00] INFO: Storing updated
cookbooks/yum/Berksfile in the cache.
[2013-05-30T07:06:14+00:00] INFO: Storing updated
cookbooks/yum/metadata.json in the cache.
[2013-05-30T07:06:15+00:00] INFO: Storing updated
cookbooks/yum/CONTRIBUTING.md in the cache.
[2013-05-30T07:06:16+00:00] INFO: Storing updated
cookbooks/yum/.gitignore in the cache.
[2013-05-30T07:06:17+00:00] INFO: Storing updated
cookbooks/yum/CHANGELOG.md in the cache.
[2013-05-30T07:06:17+00:00] INFO: Storing updated
cookbooks/yum/README.md in the cache.
[2013-05-30T07:06:18+00:00] INFO: Storing updated
cookbooks/yum/LICENSE in the cache.
[2013-05-30T07:06:19+00:00] INFO: Storing updated
cookbooks/yum/metadata.rb in the cache.
[2013-05-30T07:06:20+00:00] INFO: Storing updated
cookbooks/yum/.kitchen.yml in the cache.================================================================================
Recipe Compile Error in
/srv/chef/file_store/cookbooks/bti_mongo/recipes/default.rb================================================================================
Net::HTTPServerException
400 "Bad Request"
Cookbook Trace:
/srv/chef/file_store/cookbooks/mongodb/definitions/mongodb.rb:162:in
block in from_file' /srv/chef/file_store/cookbooks/mongodb/recipes/replicaset.rb:24:in
from_file'
/srv/chef/file_store/cookbooks/bti_mongo/recipes/default.rb:11:in
`from_file'Relevant File Content:
/srv/chef/file_store/cookbooks/mongodb/definitions/mongodb.rb:
155: ignore_failure true
156: end
157: end
158:
159: # replicaset
160: if !replicaset_name.nil?
161: rs_nodes = search(
162>> :node,
163:
"mongodb_cluster_name:#{replicaset['mongodb']['cluster_name']} AND
164: recipes:mongodb\:\:replicaset AND
165: mongodb_shard_name:#{replicaset['mongodb']['shard_name']}
AND
166: chef_environment:#{replicaset.chef_environment}"
167: )
168:
169: ruby_block "config_replicaset" do
170: block do
171: if not replicaset.nil?[2013-05-30T07:06:20+00:00] ERROR: Running exception handlers
[2013-05-30T07:06:20+00:00] FATAL: Saving node information to
/srv/chef/file_store/failed-run-data.json
[2013-05-30T07:06:20+00:00] ERROR: Exception handlers complete
[2013-05-30T07:06:20+00:00] FATAL: Stacktrace dumped to
/srv/chef/file_store/chef-stacktrace.out
[2013-05-30T07:06:20+00:00] FATAL: Net::HTTPServerException: 400 "Bad
Request"
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
--
Liam Kirsher
PGP: http://liam.numenet.com/pgp/