Can I modify the ownership for a shared folder in vagrant?

As @StephenKing suggests you can change the options of the whole directory. The relevant function is not documented but the source tells us: # File ‘lib/vagrant/config/vm.rb’, line 53 def share_folder(name, guestpath, hostpath, opts=nil) @shared_folders[name] = { :guestpath => guestpath.to_s, :hostpath => hostpath.to_s, :create => false, :owner => nil, :group => nil, :nfs => false, :transient … Read more

Vagrant + Chef: Error in provision “Shared folders that Chef requires are missing on the virtual machine.”

it seems like there is a bug with sync folders, this clears the cache and fixed it for me. (from your project directory) rm .vagrant/machines/default/virtualbox/synced_folders vagrant reload –provision https://github.com/mitchellh/vagrant/issues/5199 EDIT: this should be fixed in vagrant 1.7.4

Overriding attributes in the recipe

default.nginx_upstreams is the same as default[:nginx_upstreams] and default[‘nginx_upstreams’] – the convention is to use 1 of the latter two. And as you are using strings further, use them here too. The way you init nginx_upstreams in attribute file is the same as doing it this way: default[‘nginx_upstreams’][‘service1’] = [‘service1.server.com’] default[‘nginx_upstreams’][‘service2’] = [‘service2.server.com’] And you don’t … Read more

What is the right way to do add-apt-repository via Chef?

If you use chef v12.9 and above, Use the apt_repository resource for managing apt repositories. If you use chef lower than v12.8, you can use APT Cookbook provided by Chef Software, Inc. This cookbook provides same LWRP Following is the example usage of the resource: apt_repository “nginx-php” do uri “http://ppa.launchpad.net/nginx/php5/ubuntu” distribution node[‘lsb’][‘codename’] components [“main”] keyserver … Read more

How to move/copy files locally with Chef

How to copy single file First way I use file statement to copy file (compile-time check) file “/etc/init.d/someService” do owner ‘root’ group ‘root’ mode 0755 content ::File.open(“/home/someService”).read action :create end here : “/etc/init.d/someService” – target file, “/home/someService” – source file Also you can wrap ::File.open(“/home/someService”).read in lazy block … lazy { ::File.open(“/home/someService”).read } … Second … Read more

Chef ‘cookbook’ in Berksfile vs ‘depends’ in metadata.rb

The Berksfile is Berkshelf specific, while the metadata file is built into Chef. Adding your dependencies to the metadata file allows other applications, like librarian-chef or the supermarket, to read your dependencies as well. Note that Berkshelf reads the dependencies from metadata as well, as long as you add the metadata line to the Berksfile. … Read more