Ask Your Question

How can I install a repo and then a package from that repo in one pass?

asked 2015-12-07 18:20:59 -0600

catpants gravatar image

updated 2015-12-07 18:47:03 -0600

Hi folks,

Using the apt module from forge:

I'm also using the openldap module from forge:

Which allows you to specify a specific openldap package.

Trying to install a repo, then a package from that repo in a single pass:

class profiles::my_package {

  class { 'apt':
      ::apt::source { 'my_repo':
     location => '',   }

  class { 'openldap::server':
     require => [Class['apt'], Class['apt::update'], Apt::Source['my_repo'] ], 
     package => 'my_ldap_package',   

Note that this section:

States that you must require the repo in a class that uses the package if you want to install everything in one pass, but it looks like I have already done that.

Note however that this works:

package { 'my_ldap_package':                                           
   require => [Class['apt::update'], Apt::Source['my_repo'] ],
   ensure => 'installed',                                                  

(replacing the class { 'openldap::server': } block)

So...why doesn't the openldap module allow installation of packages in one pass the same way package does?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-12-08 12:47:55 -0600

lavaman gravatar image

This is due to the way the openldap module installs the package. It actually calls another class to do so:

This means that when you order openldap::server, it is not actually ordering the resources in openldap::server::install (because it is a different class), so there is no guarantee that your repo will be configured before the resources in openldap::server::install are applied.

edit flag offensive delete link more


Understood. How do I fix that? I have no idea. Thanks!!

catpants gravatar imagecatpants ( 2015-12-08 16:21:53 -0600 )edit

The simplest way would be to order the openldap::server::install class instead of openldap::server.

lavaman gravatar imagelavaman ( 2015-12-08 17:34:10 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-12-07 18:20:59 -0600

Seen: 106 times

Last updated: Dec 08 '15