- From: Sean Escriva <
>
- To: JOHN HASTY <
>,
- Cc:
- Subject: [chef] Re: Local install using chef_gem
- Date: Thu, 30 Jan 2014 15:39:47 -0800
JOHN HASTY
<
>
writes:
Hi John,
>
I am building servers that are behind firewalls where we don't want to
>
fetch things from the Internet. I would like to be able to obtain the gems
>
necessary for the process and copy them from our internal repository and
>
then install locally.
>
>
I tried the following:
>
>
#chef_gem "zk" do
>
#action :install
>
#end
chef_gem is for installing gems to the omnibus bundled ruby, generally
not what you want unless you intend to use the libraries directly in chef
recipes. perhaps gem_package? Also, it looks like this is commented out?
>
>
if ! File.exist?("/opt/chef/maint/gemsetup")
>
>
directory "/tmp/gems" do
>
owner "root"
>
action :create
>
end
>
>
%w(little-plugger-1.1.3.gem logger-1.2.8.gem mini_portile-0.5.2.gem
>
logging-1.7.2.gem zookeeper-1.4.8.gem zk-1.9.3.gem).each do |gemfile|
lots to be stuffing in the chef bundled roobay :)
>
>
bash "Fetch #{gemfile} and install" do
>
user "root"
>
cwd "/tmp/gems"
>
code <<-EOH
>
wget http://gitserver:4002/gems/#{gemfile}
>
/opt/chef/embedded/bin/gem install -V #{gemfile}
>
EOH
>
end
instead of a bash resource doing two things at once this may be better
split into two resource calls if you need to go this route: remote_file and
chef_gem
since chef_gem can install from the local file system, maybe something along
the lines of:
%w(little-plugger-1.1.3.gem logger-1.2.8.gem mini_portile-0.5.2.gem
logging-1.7.2.gem zookeeper-1.4.8.gem zk-1.9.3.gem).each do |gemfile|
gem_local_path = ::File.join("/tmp/gems/", gemfile)
remote_file gem_local_path do
source "
http://gitserver:4002/gems/#{gemfile}"
end
chef_gem gemfile do
source gem_local_path
end
>
>
But when I got to the line of code "require 'zk', it blew up.
>
>
>
...snip sig...
--
-sean
Archive powered by MHonArc 2.6.16.