Ask Your Question

puppet windows add wait or sleep

asked 2017-06-01 10:14:12 -0600

vvkr gravatar image

updated 2017-06-28 00:32:30 -0600

joshc gravatar image

I have a script which is having multiple file and exec resources. My question is can i add some attribute in each of these resources to take time(like sleep) before next resource is executed? I want puppet to fully complete a task before moving to another.

exec { 'Enable ASP NET 2.0' :
  command => 'C:\Windows\System32\inetsrv\appcmd.exe set app "DefaultWebSite/ShipGuestLog" "/applicationpool:ASP.NET v2.0" ',
file { 'C:\inetpub\wwwroot\ShipGuestLog\Web.config' :
  ensure => file,
  source => 'puppet:///modules/guestlog/Web.config',
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-06-02 09:42:30 -0600

DarylW gravatar image

updated 2017-06-02 09:43:16 -0600

There shouldn't be an issue with going from one task to another, however in practice I have had to do something similar before, but not in puppet.

I had a custom module that would create partitions on disks, create a filesystem on the partition, and mount it, and when I ran puppet, there was enough overhead that there were no timing issues. When I pulled that logic out of puppet and put it in a bash script (to run as a part of userdata bootstrapping pre-puppet), I had to add a 2sec sleep after partition creation before I could kick off the filesystem initialization.

You can probably create a refreshonly => true exec that runs a sleep command that you notifiy from the preveous exec, that way it will only run when the exec runs.

In the example you have above, you don't have any creates or onlyif/unless parameters to make your exec idempotent, and you should be doing that so you don't have your exec running every single puppet run.

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


Asked: 2017-06-01 10:14:12 -0600

Seen: 491 times

Last updated: Jun 28 '17