Davide Vernizzi
Davide Vernizzi

Reputation: 1407

How to deal with new versions of software when using Chef?

I have installed MySQL on a server using Chef. At the time I had installed the software, MySQL was version 5.6.36. Now version 5.6.40 of MySQL is available. If I set up a new server (or test locally with Kitchen) the new version is installed, but when I run the chef-client on the old server it says that there is nothing to do and it leaves the old version.

I think I could come up with a workaround (like creating a fake update of the recipe), but what is the best practice for this cases?

Upvotes: 0

Views: 335

Answers (1)

coderanger
coderanger

Reputation: 54181

There are a few options depending on the workflow you want. The simplest option is to override the version in an attribute on each node as needed. This is the most direct way, but also the most high-touch since you have to manage things more or less manually for each relevant server. Another option is to use a wrapper cookbook which says which version you want to use (possibly with some logic about using different versions in different places), and then deliver that wrapper cookbook out through your normal workflow/pipeline when you want to make changes. You could also store the version in an environment or policy-group-level attribute. Which is best for you is entirely up to your current team and workflow.

Upvotes: 1

Related Questions