开发者

Uninstalling a package using Chef

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜