Derek
Derek

Reputation: 4751

Use Chef recipe to make sure node has certain version of apache

I've been messing with Chef lately in order to evaluate it and learn it for use as a deployment and infrastructure option. One thing that kind of has me stuck is mainly with Apache.

The version of Apache that comes with the Ubuntu VM I'm running this node on is 2.2.22. I want to make sure that whenever my node converges (using chef-client), it upgrades to 2.4 (if it's not already at that version). The recipes/cookbooks that I've been using use the apt package manager. I know I can manually upgrade Apache using apt, but I figured there has to be a way to tell my main cookbook to do this.

Upvotes: 1

Views: 1368

Answers (1)

deepthi
deepthi

Reputation: 685

Please refer to this link for apt_package http://docs.opscode.com/resource_apt_package.html

you can specify

default[:apache][:version] = '2.4'

in your attributes/default.rb.

Then in the recipe,

apt_package "name_of_package" do
  version node[:apache][:version]
end

Upvotes: 1

Related Questions