Ask Your Question
3

Can you install .deb file from the files directory?

asked 2013-10-04 10:45:45 -0500

spuder gravatar image

updated 2013-10-06 01:17:22 -0500

The documentation shows that it is possible to use puppet to install a .deb file by using the dpkg provider. From my testing, it appears that you can only install a .deb file if it is located on the hard drive. (/vagrant/files/ in this example)

I have run 4 tests, uncommenting one line at a time, the only one that works is the 4th one.

package {'ruby2.0_2.0.0.299-2_amd64.deb': 
    ensure    => installed,
    provider  => dpkg, 
#    source    => 'puppet:///modules/gitlab/ruby2-repo/ruby2.0_2.0.0.299-2_amd64.deb',  
#    source    => 'puppet:///modules/gitlab/ruby2.0_2.0.0.299-2_amd64.deb', 
#    source    => 'http ...
(more)
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2013-10-05 20:26:42 -0500

LindaLoo gravatar image

I hate to answer a question with a "don't do that", but don't do that. :-)

The first reason is that Puppet does not perform efficiently as a file server. Additionally performance sharply deceases when you attempt to server large files or more than several hundred files like a source directory.

The second reason is creating your own internal repo is very simple these days and allows you to use the standard tools to manage your packages.

edit flag offensive delete link more

Comments

I know it isn't good to store the file locally, that is exactly what I am trying to avoid. However I've found that storing the file locally is ...(more)

spuder gravatar imagespuder ( 2013-10-05 20:45:33 -0500 )edit

You're missing the point. If you used an apt repo, you'd be done and you wouldn't be reinventing the wheel poorly.

ramindk gravatar imageramindk ( 2013-10-06 02:14:01 -0500 )edit
1

answered 2013-10-06 00:53:35 -0500

Ancillas gravatar image

updated 2013-10-06 02:50:10 -0500

Don't distribute your debs with the Puppet filesystem.

Isn't this exactly what an Apt repo is for? If you don't want to do that, you could simply use an Apache/file-system approach, and then write a Defined Type that wraps an Exec resource that downloads the deb, and a Package resource that installs it.

Update

I wrote this proof-of-concept to test installing freight from a URL. It worked, although I'd want to add a bit more validation before rolling it out.

define url-package (
  $url,
  $provider,
  $package = undef,
) {

  if $package {
    $package_real = $package
  } else {
    $package_real = $title
  }

  $package_path = "/tmp ...
(more)
edit flag offensive delete link more

Comments

Perhaps the question isn't clear, distributing the debs within puppet is exactly what I am trying to avoid, but it gives me an error when I try and use any alternative.

spuder gravatar imagespuder ( 2013-10-06 01:13:26 -0500 )edit

The doc. makes it seem like the Package resource won't process the source meta-parameter in the same way that a File resource will. Specifically, I don't think it ...(more)

Ancillas gravatar imageAncillas ( 2013-10-06 02:24:40 -0500 )edit

RPM can install from a URL, but I don't think that dpkg can, so I wouldn't expect a URL to work here. Going back to the doc, "...or ...(more)

Ancillas gravatar imageAncillas ( 2013-10-06 02:27:45 -0500 )edit

I added a defined type to wrap an install and a wget. Please read into the fact that my example installs freight, a light-weight apt repo manager.

Ancillas gravatar imageAncillas ( 2013-10-06 02:51:22 -0500 )edit
0

answered 2013-10-04 14:32:13 -0500

spuder gravatar image

As a work around, I've moved the packages to a folder called /packages, and pointed puppet there.

I'd still like to know if this could be accomplished without putting the packages on the system.

    #Create /packages folder for ruby repo's
    file { '/packages':
      ensure   => directory,
    before   => [
             File ['/packages/ruby2-0-repo'],
             File ['/etc/apt/sources.list.d/ruby2.0.list'],
             Exec ['apt-get install ruby2.0'],
             Exec ['apt-get install ruby2.0-dev'],
             Exec ['apt-get install rake'],
             ],
    }

    #Place the custom ruby package in /packages/ruby2-0-repo
    file { '/packages/ruby2-0-repo':
      source   => "puppet:///modules/gitlab/ruby2-repo",
      mode     => '0755', 
      recurse  => true,
      before   => [
                   File ['/etc/apt/sources.list ...
(more)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-10-04 10:45:45 -0500

Seen: 5,892 times

Last updated: Oct 06 '13