I have been using Chef to manage our servers.
My roles/app.rb looks like this:
name "app"
description "App server"
run_list [
"recipe[apt]",
...,
...,
"recipe[nginx]"
...,
...,
]
Now I would like to remove the nginx package from the machine. If I remove the nginx recipie in run_list, will it remove nginx from the nodes? If not please advise me what is the best strategy to have change-management on nodes.
Cookbooks are fundamental working units of Chef, which consists of all the details related to working units, having the capability to modify configuration and the state of any system configured as a node on Chef infrastructure. Cookbooks can perform multiple tasks.
A chef-client is an agent that runs locally on every node that is under management by Chef. When a chef-client is run, it will perform all of the steps that are required to bring the node into the expected state, including: Registering and authenticating the node with the Chef server.
If you remove nginx from the run_list that particular recipe just won't run. It won't actually remove nginx from the nodes because it doesn't know how to. I was actually pondering about this yesterday.
You can write your own recipe which undoes recipe[nginx] maybe recipe[remove_nginx] or something like that. Following that you can then remove recipe[remove_nginx].
Someone else also thinks this is a good way to do things which is at least a little reassuring:
http://community.opscode.com/questions/6
Apparently you can remove a recipe from the run_list in a ruby_block, so that saves you the hassle of using knife to remove it yourself after it is run:
https://gist.github.com/883522
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