I am trying to configure my Vagrant file to have some chef attributes, but I must be doing something wrong because the chef recipes are using the defaults instead of my the attributes I am trying to set. Here is my config section of my vagrant file:
config.vm.provision :chef_solo do |chef|
chef.json = {
:mysql => {
:server_root_password => 'password'
},
:nodejs => {
:version => '0.6.14',
:dir => '/usr/local',
:npm => '1.1.13'
}
}
chef.cookbooks_path = "config/env/cookbooks"
chef.add_recipe "apt"
chef.add_recipe "mongodb::10gen_repo"
chef.add_recipe "mongodb"
chef.add_recipe "mysql::client"
chef.add_recipe "mysql::server"
chef.add_recipe "nodejs"
chef.add_recipe "nodejs::npm"
#chef.add_recipe "mymc_service"
end
Is my Ruby wrong or is there a better way to do this?
Chef Zero is a simple, easy-install, in-memory Chef server that can be useful for Chef Client testing and chef-solo-like tasks that require a full Chef Server. It IS intended to be simple, Chef 11+ compliant, easy to run and fast to start. It is NOT intended to be secure, scalable, performant or persistent.
Provisioners in Vagrant allow you to automatically install software, alter configurations, and more on the machine as part of the vagrant up process. This is useful since boxes typically are not built perfectly for your use case.
Provisioner name: puppet The Vagrant Puppet provisioner allows you to provision the guest using Puppet, specifically by calling puppet apply , without a Puppet Master. Warning: If you are not familiar with Puppet and Vagrant already, it is recommended to start with the shell provisioner.
I'm brand new to Vagrant, Ruby, and Chef, but this is what worked for me:
config.vm.provision :chef_solo do |chef|
chef.json = {
"mysql" => {
"server_root_password" => "password"
}
}
chef.add_recipe "mysql" # etc
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With