[chef] Re: Re: yum install from URL


Chronological Thread 
  • From: Paul Graydon < >
  • To:
  • Subject: [chef] Re: Re: yum install from URL
  • Date: Sun, 06 Jan 2013 12:23:06 -1000

I would urge caution in the use of this. Depending on 3rd party / non-yum repo sources will cause cookbooks to completely fail if the 3rd party source has gone away or is offline for a bit. I know it's caused me more than a few headaches in the past.

You could put the RPM in the cookbook but that's possibly a little ugly, depending on the size of it. Alternatively you could keep a copy on your own server to fetch from. An added advantage of this is you know exactly what is being installed on your servers.

I've got something based on this in one of our recipes:

remote_file "#{Chef::Config[:file_cache_path]}/check_mk-agent-#{version}.noarch.rpm" do
source "https://foo.bar.baz/checkmk/check_mk-agent-#{version}.noarch.rpm";
      not_if "rpm -qa | grep -q '^check_mk-agent-#{version}'"
      notifies :install, "rpm_package[check_mk]", :immediately
    end

    rpm_package "check_mk" do
source "#{Chef::Config[:file_cache_path]}/check_mk-agent-#{version}.noarch.rpm"
only_if {::File.exists?("#{Chef::Config[:file_cache_path]}/check_mk-agent-#{version}.noarch.rpm")}
      action :nothing
    end

It occurs to me that maybe the latter isn't such a smart idea. I'm not sure what Chef does underneath it all, but if there are dependencies then using RPM will probably fail. Thinking possibly better to substitute the 2nd block with this (and adjust the notifies in the 1st block). According to docs.opscode.com specifying "source" in the yum_package resource will cause it to do "yum localinstall"

    yum_package "check_mk" do
source "#{Chef::Config[:file_cache_path]}/check_mk-agent-#{version}.noarch.rpm"
only_if {::File.exists?("#{Chef::Config[:file_cache_path]}/check_mk-agent-#{version}.noarch.rpm")}
      action :nothing
    end

Paul

On 01/06/2013 12:00 PM, Sean OMeara wrote:
Hi Jordi!

try this:

package "rabbit" do
   source 
"http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.1/rabbitmq-server-3.0.1-1.noarch.rpm";
   action :install
   provider Chef::Provider::Package::Rpm
end

-s

On Sun, Jan 6, 2013 at 4:47 PM, Jordi Llonch 
< >
 wrote:
Hi,

How can I run the following command using a recipe?

yum install -y
http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.1/rabbitmq-server-3.0.1-1.noarch.rpm

Thanks,
Jordi




Archive powered by MHonArc 2.6.16.

§