Module ordering in nodes.pp

64 views
Skip to first unread message

Sam Rajagopal

unread,
Jan 27, 2014, 2:05:16 AM1/27/14
to puppet...@googlegroups.com
I have nodes.pp defined as follows
 
node "abc.x.com", "123.x.com" {
include module1
include module2
include module3
}
 
Very simple definition. No parameterization, no scoping etc
When I run "puppet agent -t" on the agent, I see the execution jumping to module 3 after module 1.
Not sure how I can do "before" or "after" to say - execute module 2 only if module 1 is successful.
 
Also, I get different results when I run the agent second time. Say, something was owned by app user. Next time it becomes, root user.
appreciate any help.

Jose Luis Ledesma

unread,
Jan 27, 2014, 2:46:55 AM1/27/14
to puppet...@googlegroups.com
You have to make use of chaining arrows in order to establish a dependency.

http://docs.puppetlabs.com/puppet/3/reference/lang_relationships.html#chaining-arrows

Regards,

jcbollinger

unread,
Jan 27, 2014, 9:28:38 AM1/27/14
to puppet...@googlegroups.com


On Monday, January 27, 2014 1:05:16 AM UTC-6, Sam Rajagopal wrote:
I have nodes.pp defined as follows
 
node "abc.x.com", "123.x.com" {
include module1
include module2
include module3
}
 
Very simple definition. No parameterization, no scoping etc
When I run "puppet agent -t" on the agent, I see the execution jumping to module 3 after module 1.
Not sure how I can do "before" or "after" to say - execute module 2 only if module 1 is successful.
 


The order in which Puppet applies resources between which there are is no relationships is not predictable.  As Jose says, you can express relationships between classes via the chaining arrows, just as if classes were resources.  For example,

    Class['module1'] => Class['module2'] => Class['module3']

That gives you both ordering and dependency: if an earlier resource [/class] in such a chain fails, then the later ones will not be applied.  And that's sensible, because if there is no dependency between two classes / resources then there should be no need for controlling their relative order of application.

 
Also, I get different results when I run the agent second time. Say, something was owned by app user. Next time it becomes, root user.
appreciate any help.


There is no way we can guess what might be causing the different results without examining the relevant manifests.


John
 
Reply all
Reply to author
Forward
0 new messages