I haven't been able to cache the RPM through Kitchen, but I have solved the problem by downloading the file myself and providing it to Kitchen.
- Download RPM file
- Put it in a local folder alongside your
.kitchen.yml
. e.g. chef-pkgs
- Kitchen downloads chef packages to a
/tmp
directory, so set up a synced folder in your .kitchen.yml
with the chef-pkgs
folder. Example:
Example .kitchen.yml
:
driver:
name: vagrant
vagrantfiles:
- Vagrantfile
synced_folders:
- ["./chef-pkgs", "/tmp/chef-pkgs"]
provisioner:
name: chef_zero
require_chef_omnibus: 12.4.1
chef_omnibus_url: file:///tmp/chef-pkgs/install.sh
- Create an
install.sh
file in your chef-pkgs
folder that installs the RPM from the cached location.
Example install.sh
:
#! /bin/bash
sudo rpm -ivh /tmp/chef-pkgs/chef-12.4.1-1.el6.x86_64.rpm
I got the idea and code from this helpful blog post: http://erichelgeson.github.io/blog/2014/09/23/simple-chef-package-cache/
I added the chef-pkgs
folder to my .gitignore
file.