Running classes in a certain order

25 views
Skip to first unread message

Jason Gagui

unread,
Apr 1, 2015, 5:19:19 PM4/1/15
to puppet...@googlegroups.com
Hello, 

I created a module to perform the following on a windows server 2012 R2 system: 

1.  JoinDomain_then_reboot.pp

Then after reboot: 

1.  Install_IIS.pp
2.  Create_website.pp
3.  copy_sitecontent.pp

I want to make sure those four classes run in the order specified above.  I was able to use "notify" to delay reboot until the server was joined to the domain but the other classes run as well and the reboot occurs during IIS installation.  

How would I make sure  the four classes run in the specified order above?

Thanks,

Jason

Felix Frank

unread,
Apr 1, 2015, 7:16:34 PM4/1/15
to puppet...@googlegroups.com
On 04/01/2015 09:03 PM, Jason Gagui wrote:
>
> How would I make sure the four classes run in the specified order above?

Hi,

an intermittent reboot implies that the three latter classes *cannot* be
evaluated during the same agent transaction as the first one. To
implement this, add a custom fact to the module, which indicates whether
the reboot after evaluation of the first class has succeeded. Include
the other classes only if this fact has the expected value.

As a side note, I see how such a triggered reboot is convenient, but I
would have reservations about deploying a module that will do that when
it deems necessary. It just feels kind of risky. An alternative could be
an explicit message (via notify resource) that the agent keeps adding to
reports until the operator reboots manually. That's just my 2c though.

Cheers,
Felix

Brian Morris

unread,
Apr 1, 2015, 7:25:39 PM4/1/15
to puppet...@googlegroups.com
Hello Jason,

Instead of treating each object as a separate class, what do you think about putting them all in one class? This would allow you to then control the flow of objects within the class by ordering them something like this:

Package["IIS"] -> File["site config"] -> File["site content"] -> Notify["IIS"]

Brian
Reply all
Reply to author
Forward
0 new messages