puppet dependency for conditional statement

736 views
Skip to first unread message

Weng Wilson

unread,
Mar 25, 2014, 4:00:13 AM3/25/14
to puppet...@googlegroups.com
Hi,

I'm new to puppet. Our deployment process is kind of sequential, so I frequently use chain arrow "->" to solve the dependency. But when there is conditional statements such as "if ... else ..." , the chain will broken. The next operation cannot design which resource to depend on.
Could anybody suggest me some good way or better structure to solve that?

Thanks
Wilson

jcbollinger

unread,
Mar 25, 2014, 1:17:34 PM3/25/14
to puppet...@googlegroups.com


You can use the require / before / subscribe / notify resource metaparameters instead of chaining operators.  You can also chain resource references instead of directly chaining declarations:

  Package['foo'] -> File['/etc/foo.conf']

And you can hide conditionals inside defined types, or simply move them elsewhere.  Variations on the last are particularly popular, as they include aspects of the "roles and profiles" pattern as well as common applications of hiera.


John

Reply all
Reply to author
Forward
0 new messages