Ask Your Question
0

Modules Execution Dependency

asked 2015-03-04 20:58:11 -0500

Kitty Yeung gravatar image

updated 2015-03-05 21:12:51 -0500

I have 2 modules, let's say "a" and "b". In module "a", I have included module "b", so, when module "a" is executed, module "b" will also be executed as well to let module "a" run successfully. Module "a" has a dependeny on module "b". It works well when I go into the module folder on Puppet Master module "a" for testing.

$ puppet apply init.pp

Apply module "a" command can also help to apply the module "b" However, when I use the PE console runonce function with tags "a", the module "a" failed because the module "b" is not appled automatically. I have added the classes of "a" and "b" to the server already. Here is the example of module "a" and "b" and "init.pp",

Module "a"

class a { include b # do something }

Module "b"

class b { # do something }

init.pp

class { 'a': }

Is there anything wrong on my scripts ?

===========================================

Thanks Greg. I have added the class "a" and class "b" to the node via the PE console.

The test commandline is run on the Puppet Master, and it is good.

/etc/puppetlabs/puppet/modules/a/tests/init.pp => which run the class {'a':} $ puppet apply init.pp

The failure case is on the PE console, where I go to Live Management - Control Puppet and execute the class "a". So, I guess my question can be restructured as follow. - What should I do if I just want to run the class "a" on a node via PE console ? - And I want PE to help applying all dependency for class "a" . - And the user who apply the class "a" should not need to know about class "b".

edit retag flag offensive close merge delete

Comments

I don't see any problem with either method. If class A includes class B and you assign class A to a node in the PE console, the node will receive the resources from class A and class B when they are compiled into a catalog. What indication do you have that the resources in class B are not applied?

GregLarkin gravatar imageGregLarkin ( 2015-03-06 12:33:31 -0500 )edit

Seems the dependency doesn't work when I used "define type" to specify the "last task". After I changed it to "class", it works as expected.

Kitty Yeung gravatar imageKitty Yeung ( 2015-03-16 00:41:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-05 18:34:56 -0500

GregLarkin gravatar image

You mentioned "tags" above, but tags and classes are not the same thing. Have you classified your node with class "a" in the PE console? That's the way to make sure the node has the resources from class a and class b applied to it.

Also, are you invoking the Live Management runonce command against your Puppet master, or some other node in your infrastructure? You seem to know that the puppet apply command will modify the configuration of your master, and that's fine, as long as you're targeting the same host in Live Management. If you are not targeting the same host, it's possible that the Puppet code will apply differently to a different node.

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

1 follower

Stats

Asked: 2015-03-04 20:58:11 -0500

Seen: 96 times

Last updated: Mar 05 '15