[chef] Re: Using Chef offline


Chronological Thread 
  • From: Joe Nuspl < >
  • To:
  • Subject: [chef] Re: Using Chef offline
  • Date: Wed, 20 May 2015 01:21:16 -0700

I often work on my laptop while disconnected from the internet.  I use “wget -X” to mirror files while I do have access.  For example:


This creates the directory structure:

   +- el
      +- 6
         +- x86_64
            +- chef-12.3.0-1.el6.x86_64.rpm

Apache on my laptop has the following configuration:

Listen 1080

<VirtualHost *:1080>
DocumentRoot "/var/mirror"

<Directory "/var/mirror">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

RewriteEngine on
RewriteCond     /var/mirror/%{HTTP_HOST} -d
RewriteRule     .* /%{HTTP_HOST}%{REQUEST_FILENAME} [L]

RewriteRule     .* - [R=502,L]
</VirtualHost>

On my vagrant boxes, in /etc/chef/client.rb I set:


When chef runs, all “external” http requests are routed to and serviced by apache running on my laptop.

When the request for http://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.3.0-1.el6.x86_64.rpm comes in, apache will check for the existence of /var/mirror/opscode-omnibus-packages.s3.amazonaws.com If that does not exist, a 502 (Bad Gateway) is returned.  Otherwise apache will try to serve /var/mirror/opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.3.0-1.el6.x86_64.rpm If that path does not exist, a 404 is returned.  For my own benefit, I like to differentiate between a host I have not mirrored (502) and a path that has not been mirrored (404).

As long as the requests are http, this scheme works nicely.  For https endpoints, I mirror them with wget as well but I use chef-rewind to change the protocol to http.

I’ve just this method for RPMs, jenkins plugins, gems, and github release tar balls.

This method should work within an isolated environment as well.

Joe



On May 19, 2015, at 7:18 PM, Tim Leicy < "> > wrote:

Does anyone know if there is a way to have chef pre-download cookbook dependencies from remote urls into a "cache".
I have a lot of computers that have no internet access but would like to use chef and community cookbooks to manage them. It is a real pain to manually download the remote files and override the file locations in the cookbooks. I have looked around but really haven't found a good way to manage this, but maybe I missed something. Any suggestions? If there is currently no capability for this, any suggestions on how I should modify chef to incorporate this functionality?

Thanks! 
 Tim




Archive powered by MHonArc 2.6.16.

§