Modules order

Hello all,

I have 2 modules (local_repositroy & spacewalk) assigned to my hosts via
Foreman
I need the local_repositroy module to run before the spacewalk module so
that the hosts will be able to install spacewalk from the local_repository.
How can I make the local_repository module run before the spacewalk module?
I have tried to add to the local_repositroy module the following line:
Class['local_repository'] -> Class['spacewalk']

But for some reason it doesn't work:

Info: Applying configuration version '1414571186'
Notice: /Stage[main]/Spacewalk::Config/Exec[register-client]/returns:
executed successfully
Notice: /Stage[main]/Local_repository::Config/Yumrepo[xio_custom]/ensure:
created
Info: changing mode of /etc/yum.repos.d/xio_custom.repo from 600 to 644
Notice: Finished catalog run in 5.38 seconds

Anyone?

בתאריך יום רביעי, 29 באוקטובר 2014 10:41:47 UTC+2, מאת Royee Tager:

··· > > Hello all, > > I have 2 modules (local_repositroy & spacewalk) assigned to my hosts via > Foreman > I need the local_repositroy module to run before the spacewalk module so > that the hosts will be able to install spacewalk from the local_repository. > How can I make the local_repository module run before the spacewalk module? > I have tried to add to the local_repositroy module the following line: > Class['local_repository'] -> Class['spacewalk'] > > But for some reason it doesn't work: > > Info: Applying configuration version '1414571186' > Notice: /Stage[main]/Spacewalk::Config/Exec[register-client]/returns: > executed successfully > Notice: /Stage[main]/Local_repository::Config/Yumrepo[xio_custom]/ensure: > created > Info: changing mode of /etc/yum.repos.d/xio_custom.repo from 600 to 644 > Notice: Finished catalog run in 5.38 seconds >

Hello.

It's rather simple. What you need is to call classes in correct order from
wrapper class.
It's described a lot of times for puppet.

Create a class which calls local repository class and then spacewalk class.
Ordering can be done using '->'.

So you would include wrapper class in foreman host configuration. And if
you need to override some variables in spacewalk or localrepository classes
you would need to define these variables in wrapper class configuration
(Like it's done in previous post). I suggest to use standard puppet
technique.

Thanks,
Mikhail.

Hello.

You have two options to solve your problem:

  1. (Simple One) create a wrapper module which firstly adds repository and
    then installs spacewalk.
  2. (Not sure how hard One) insert local repository to spacewalk module.

For me I've solved such problem using this simple module:

define ubuntu-tools::packages {
if ! defined(Package[$name]) {
package { $name:
ensure => present,
}
}
}

define ubuntu-tools::absent {
if ! defined(Package[$name]) {
package { $name:
ensure => absent,
}
}
}

class ubuntu-tools (
$packages = [
'iftop',
'sysstat',
'iotop',
'vim',
'screen',
'curl',
],
$absent = [
'apparmor',
],
) {
apt::source { 'apt.XXXXX.XX':
location => 'http://apt.XXXXX.XX/',
release => 'precise',
include_deb => true,
include_src => false,
architecture => 'amd64',
repos => 'main',
key => 'XXXXXXXX',
key_source => 'http://apt.XXXXX.XX/apt.XXXXX.XX.pub',
} ->

ubuntu-tools::packages { $packages: }

ubuntu-tools::absent { $absent: }

}

Maybe this one will help you somehow.

Thanks,
Mikhail.

Hi,

The 2 modules have some class parameters and usually I use the smart class
parameter of the Foreman.
How do I tie it all together?

בתאריך יום חמישי, 30 באוקטובר 2014 10:42:22 UTC+2, מאת Mikhail Shevtsov:

··· > > Hello. > > It's rather simple. What you need is to call classes in correct order from > wrapper class. > It's described a lot of times for puppet. > > Create a class which calls local repository class and then spacewalk > class. Ordering can be done using '->'. > > So you would include wrapper class in foreman host configuration. And if > you need to override some variables in spacewalk or localrepository classes > you would need to define these variables in wrapper class configuration > (Like it's done in previous post). I suggest to use standard puppet > technique. > > Thanks, > Mikhail. >

Hi Mikhail,

I don't understand how to write the wrapper module.
Attached is a ZIP file which contains the 2 modules (local_repository &
spacewalk)
How can I make the local_repository run before spacewalk? How will you
write the wrapper?

Thank you in advance,

Royee Tager

··· On Wed, Oct 29, 2014 at 4:50 PM, Mikhail Shevtsov wrote:

Hello.

You have two options to solve your problem:

  1. (Simple One) create a wrapper module which firstly adds repository and
    then installs spacewalk.
  2. (Not sure how hard One) insert local repository to spacewalk module.

For me I’ve solved such problem using this simple module:

define ubuntu-tools::packages {
if ! defined(Package[$name]) {
package { $name:
ensure => present,
}
}
}

define ubuntu-tools::absent {
if ! defined(Package[$name]) {
package { $name:
ensure => absent,
}
}
}

class ubuntu-tools (
$packages = [
‘iftop’,
‘sysstat’,
‘iotop’,
‘vim’,
‘screen’,
‘curl’,
],
$absent = [
‘apparmor’,
],
) {
apt::source { ‘apt.XXXXX.XX’:
location => ‘http://apt.XXXXX.XX/’,
release => ‘precise’,
include_deb => true,
include_src => false,
architecture => ‘amd64’,
repos => ‘main’,
key => ‘XXXXXXXX’,
key_source => ‘http://apt.XXXXX.XX/apt.XXXXX.XX.pub’,
} ->

ubuntu-tools::packages { $packages: }

ubuntu-tools::absent { $absent: }

}

Maybe this one will help you somehow.

Thanks,
Mikhail.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Don't use the smart class parameters of the 2 modules directly. Write a
third module that has the smart class parameters you want and passes them
to the 2 modules and define those in Foreman.

··· On Thu, Oct 30, 2014 at 8:30 AM, Royee Tager wrote:

Hi,

The 2 modules have some class parameters and usually I use the smart class
parameter of the Foreman.
How do I tie it all together?

בתאריך יום חמישי, 30 באוקטובר 2014 10:42:22 UTC+2, מאת Mikhail Shevtsov:

Hello.

It’s rather simple. What you need is to call classes in correct order
from wrapper class.
It’s described a lot of times for puppet.

Create a class which calls local repository class and then spacewalk
class. Ordering can be done using ‘->’.

So you would include wrapper class in foreman host configuration. And if
you need to override some variables in spacewalk or localrepository classes
you would need to define these variables in wrapper class configuration
(Like it’s done in previous post). I suggest to use standard puppet
technique.

Thanks,
Mikhail.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.