I'm pretty new to chef. I'm using it to provision a vagrant development environment using the apache2-windows cookbook, which inconveniently has very little by way of documentation. I have managed to get it to install, and even play nicely with opscodes php cookbook, but I'm struggling to get it to set up a vhost.
So far I have added the vhosts 'extra' to /attributes/default.rb like so:
default['apache']['windows']['extras'] = ["vhosts"]
That successfully adds a 'vhosts.d' directory to apache root, includes httpd-vhosts.conf in httpd.conf, and adds an entry to httpd-vhosts.conf which includes *.conf in the 'vhosts.d' directory.
Unfortunately I can't quite figure out how to use the virtualhost resource provided with the recipe, which looks like it should be putting my vhosts into the 'vhosts.d' using the /templates/default/virtualhost.conf.erb template.
I have added the following to /recipes/default.rb
virtualhost "mysite.localhost" do
server_aliases ["www.mysite.localhost"]
docroot "/vagrant"
action :create
end
but it fails, telling me 'No resource or method named 'virtualhost' for 'Chef::Recipe "default"'.
What am I missing? Is there something else I need to do to allow me to use the virtualhost resource in my recipe?