使用 Chef 卸载软件包

发布于 2024-12-04 14:38:10 字数 318 浏览 4 评论 0原文

我一直在使用 Chef 来管理我们的服务器。

我的 Roles/app.rb 如下所示:

name "app"

description "App server"

run_list [
    "recipe[apt]",
    ...,
    ...,
    "recipe[nginx]"
    ...,
    ...,
]

现在我想从计算机中删除 nginx 包。 如果我删除 run_list 中的 nginx recipie,它会从节点中删除 nginx 吗?如果没有,请告诉我在节点上进行变更管理的最佳策略是什么。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪 2024-12-11 14:38:10

如果您从 run_list 中删除 nginx,则该特定配方将不会运行。它实际上不会从节点中删除 nginx,因为它不知道如何删除。其实我昨天也在思考这个问题。

您可以编写自己的配方来撤消配方[nginx]也许配方[remove_nginx]或类似的东西。接下来,您可以删除配方[remove_nginx]。

其他人也认为这是一种做事的好方法,至少让人有点放心:

http://community.opscode.com/ questions/6

显然,您可以从 ruby​​_block 中的 run_list 中删除配方,这样就可以省去在运行后使用刀自行删除它的麻烦:

https://gist.github.com/883522

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文