Piotr Stapp
Piotr Stapp

Reputation: 19830

Reuse recipe in Chef

I would like to reuse same recipe multiple times. For example I have a recipe to install certificate on Windows machine (download it, put in in proper store, ...). But depends on machine/role I would like to run it only for X certificates.

I am using full chef infrastructure.

Upvotes: 0

Views: 440

Answers (1)

StephenKing
StephenKing

Reputation: 37580

Chef two another concepts that fit this task better than recipes do:

  • Definititons: Allows you to combine multiple resources (remote_file, execute, etc) to one new resource. Probably the right thing for you.
  • Libraries: Are plain ruby code and fit fore more complex tasks.

As suggested by Sebastian, you can still iterate over a data bag in a recipe. Although this is true, the cleaner way to group the tasks download it, put in in proper store, ... would be a definition or library.

Upvotes: 2

Related Questions