Search code examples
chef-infrachef-recipe

How to remove the recipes from the Node for Chef


I have run sudo chef-client on the node, and it have the files inside the node. But now I would like to remove the package from the node. If I remove the recipie in run_list from chef-server, it will not remove from the nodes.

please advise me what is the best way to have remove the package on nodes.


Solution

  • Every resource in Chef has one or more actions. Usually the default action is something along the lines of install or create, but they generally offer the reverse as well. In this case you would want to make a new recipe (or change the existing one) with a resource like:

    package 'foo' do
      action :remove
    end