I have a basic machine resource:
machine 'admin' do
recipe 'my_custom_cookbook::super_secret_recipe'
ohai_hints 'ec2' => '{}'
action :converge
converge true
end
How can I run a specific version (let's say 0.0.5) of my_custom_cookbook::super_secret_recipe
against this machine
resource?
It seems that just adding
depends 'my_custom_cookbook', '0.0.5'
to the metadata file doesn't work. It always pick the latest version
The provisioning cookbook has no direct relationship to the node it creates so that's why adding that depends wouldn't help. There are three ways to control what version of a cookbook gets used:
cheffish
/chef-provisioning
have direct support for setting policy name/group yet but you could use the raw_json
property probably.chef_environment
property on the machine
resource. Check the Chef docs for more detailed info on using environments.recipe 'my_custom_cookbook::super_secret_recipe@0.0.5'
. This is a rarely-used feature of Chef and so might not be supported in all places/tools.