Example I have a cookbook with the version 18.104.22.168. I uploaded to chef server. I realized I did something wrong with the cookbook content how do i rollback to previous version 22.214.171.124. Since this is production cookbook I do not want to take risk uploading wrong cookbook. I just changed the cookbook version in the metadata.rb still I see chef-server is using my recent cookbook I uploaded 126.96.36.199.
You can use knife cookbook delete to remove the broken version from your Chef Server. If you don’t want to delete it, you can also use environment restrictions to lock that node down to force the older version, though this might be tricky if you aren’t already using chef environments. Also check out the knife-solve plugin to see which version of each cookbook is going to be used on a node.
The knife cookbook delete command will remove the cookbook from the Chef Server. You may specify both the name of the cookbook and the version of the cookbook you would like to delete. When you specify a version, only that version of the cookbook will be removed from the Chef Server. All other versions of the cookbook will remain on the Chef Server.
The knife cookbook delete command will not change any of the files you have locally. You will still have the current version on your local file system.
Based on my understanding of your initial question I believe this is what you are looking for. Perhaps we need more detail about the exact thing you are trying to accomplish?