Random thoughts of a warped mind…

February 6, 2012

Installing a .deb file via Chef/Knife (when trying to use dpkg_package)

Filed under: All,EC2,Linux,Ruby — Srinivas @ 14:56

If you manage several Linux systems and are looking at a way to add configuration management to your setup, you may want to check out Chef .

You would normally install standard Ubuntu packages in Chef using the “package” directive, this approach works well with packages visible via Apt. But lets say you have a package you want to install from a “local .deb” file (maybe you have a custom package you want to install but not from the Apt repos). Chef provides a “dpkg_package” directive which allows you to do that – and thats what I tried.

However using the following led to my Knife run breaking:

While the cookbook file I save in my Chef cookbook (glusterfs_3.2.1-1_amd64.deb) did get copied to /var/chef-package-cache/glusterfs_3.2.1-1_amd64.deb on the target node, the dpkg_package directive did find it but could not install it (I did’nt copy the stack trace, maybe I should have)… After trying a few variations, I gave up on using dpkg_package and instead used the “Chef::Provider::Package::Dpkg” provider directly like this:

Note: There is no “/var/chef-package-cache” normally – You would have to create it before in the same recipe/cookbook.

Powered by WordPress