[Puppet - Feature #12630] (Accepted) Add scheduled task for executing puppet periodically

207 views
Skip to first unread message

tic...@puppetlabs.com

unread,
Feb 14, 2012, 1:59:22 PM2/14/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com
Issue #12630 has been reported by Josh Cooper.

Feature #12630: Add scheduled task for executing puppet periodically

  • Author: Josh Cooper
  • Status: Accepted
  • Priority: Normal
  • Assignee: Josh Cooper
  • Category: windows
  • Target version: 2.7.x
  • Affected Puppet version:
  • Keywords:
  • Branch:

The puppet msi should create a scheduled task to execute puppet agent every 30 minutes. The task should be configured to run as SYSTEM, which can be done using the /ru option:

C:\>schtasks /create /sc minute /mo 30 /tn puppet /tr c:\WINDOWS\system32\calc.exe /ru SYSTEM
INFO: The schedule task "puppet" will be created under user name ("NT AUTHORITY\SYSTEM").
SUCCESS: The scheduled task "puppet" has successfully been created.

In addition, the task needs to “Run with highest privileges” on Windows 2008/Vista/Win 7. See http://technet.microsoft.com/en-us/library/cc722152.aspx. This can be specified using the /rl flag.

C:\>schtasks /create /sc minute /mo 30 /tn puppet /tr c:\WINDOWS\system32\calc.exe /ru SYSTEM /rl highest
SUCCESS: The scheduled task "puppet" has successfully been created.

The version of windows can be detected using facter (Facter.value(:kernelmajversion).to_f >= 6.0) See this page for information about major versions in windows http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

During uninstall we should remove the scheduled task.

C:\>schtasks /delete /tn puppet

You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account

tic...@puppetlabs.com

unread,
Feb 16, 2012, 6:36:37 PM2/16/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com
Issue #12630 has been updated by Josh Cooper.
  • Description updated

Feature #12630: Add scheduled task for executing puppet periodically

  • Author: Josh Cooper
  • Status: Accepted
  • Priority: Normal
  • Assignee: Josh Cooper
  • Category: windows
  • Target version: 2.7.x
  • Affected Puppet version:
  • Keywords:
  • Branch:

The puppet msi should create a scheduled task to execute puppet agent every 30 minutes. The task should be configured to run as SYSTEM (aka LocalSystem).

On 2003:

C:\>schtasks.exe /create /sc minute /mo 30 /tn puppet /ru SYSTEM /tr "c:\path\to\puppet.bat agent"
INFO: The schedule task "puppet" will be created under user name ("NT AUTHORITY\SYSTEM").
SUCCESS: The scheduled task "puppet" has successfully been created.

On 2008/Vista/etc, see http://technet.microsoft.com/en-us/library/cc722152.aspx, we need to “run with highest privileges”:

C:\>schtasks.exe /create /sc minute /mo 30 /tn puppet /ru SYSTEM /rl highest /tr "c:\path\to\puppet.bat agent"
SUCCESS: The scheduled task "puppet" has successfully been created.

Arguments can be specified in the scheduled task, e.g. puppet.bat agent —debug.

The version of windows can be detected using facter (Facter.value(:kernelmajversion).to_f >= 6.0) See this page for information about major versions in windows http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

During uninstall we should remove the scheduled task.

C:\>schtasks /delete /tn puppet

Note that the installer should not add ruby to the system PATH environment variable, as doing so would require a reboot for the scheduled task to run. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can install from there

tic...@puppetlabs.com

unread,
Mar 1, 2012, 6:50:33 PM3/1/12
to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com
Issue #12630 has been updated by Josh Cooper.

Feature #12630: Run puppet periodically

    • Author: Josh Cooper
    • Status: Accepted
    • Priority: Normal
    • Assignee: Josh Cooper
    • Category: windows
    • Target version: 2.7.x
    • Affected Puppet version:
    • Keywords:

    The puppet msi should install puppet agent to run as a service. It should run as SYSTEM (aka LocalSystem) and abide by the runinterval specified in puppet.conf. It should be possible to pass arguments when starting the service. It should log somewhere so that failures to run can be debugged. It should not modify the system PATH environment variable (for ruby), as doing so would require a reboot. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can run from there.

    tic...@puppetlabs.com

    unread,
    Mar 1, 2012, 6:50:45 PM3/1/12
    to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com
    Issue #12630 has been updated by Josh Cooper.
    • Status changed from Accepted to In Topic Branch Pending Review

    Feature #12630: Run puppet periodically

    • Author: Josh Cooper
    • Status: In Topic Branch Pending Review
    • Priority: Normal
    • Assignee: Josh Cooper
    • Category: windows
    • Target version: 2.7.x
    • Affected Puppet version:
    • Keywords:

    The puppet msi should install puppet agent to run as a service. It should run as SYSTEM (aka LocalSystem) and abide by the runinterval specified in puppet.conf. It should be possible to pass arguments when starting the service. It should log somewhere so that failures to run can be debugged. It should not modify the system PATH environment variable (for ruby), as doing so would require a reboot. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can run from there.

    tic...@puppetlabs.com

    unread,
    Mar 6, 2012, 10:56:28 PM3/6/12
    to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com, je...@puppetlabs.com
    Issue #12630 has been updated by Josh Cooper.
    • Status changed from In Topic Branch Pending Review to Merged - Pending Release

    Merged in https://github.com/puppetlabs/puppet_for_the_win/commit/a18e7dc


    Feature #12630: Run puppet periodically

    • Author: Josh Cooper
    • Status: Merged - Pending Release
    • Priority: Normal
    • Assignee: Josh Cooper
    • Category: windows
    • Target version: 2.7.x
    • Affected Puppet version:
    • Keywords:

    The puppet msi should install puppet agent to run as a service. It should run as SYSTEM (aka LocalSystem) and abide by the runinterval specified in puppet.conf. It should be possible to pass arguments when starting the service. It should log somewhere so that failures to run can be debugged. It should not modify the system PATH environment variable (for ruby), as doing so would require a reboot. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can run from there.

    tic...@puppetlabs.com

    unread,
    Mar 15, 2012, 4:17:54 PM3/15/12
    to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com, je...@puppetlabs.com
    Issue #12630 has been updated by Daniel Pittman.

    Please update your ticket to reflect the version this was merged to.


    Feature #12630: Run puppet periodically

    • Author: Josh Cooper
    • Status: Merged - Pending Release
    • Priority: Normal
    • Assignee: Josh Cooper
    • Category: windows
    • Target version: 2.7.x
    • Affected Puppet version:
    • Keywords:

    The puppet msi should install puppet agent to run as a service. It should run as SYSTEM (aka LocalSystem) and abide by the runinterval specified in puppet.conf. It should be possible to pass arguments when starting the service. It should log somewhere so that failures to run can be debugged. It should not modify the system PATH environment variable (for ruby), as doing so would require a reboot. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can run from there.

    tic...@puppetlabs.com

    unread,
    Mar 15, 2012, 5:30:03 PM3/15/12
    to ja...@lovedthanlost.net, puppe...@googlegroups.com, r...@devco.net, k...@puppetlabs.com, tux...@gmail.com, sanjiv...@gmail.com, jo...@puppetlabs.com, je...@puppetlabs.com
    Issue #12630 has been updated by Josh Cooper.
    • Status changed from Merged - Pending Release to Closed
    • Target version changed from 2.7.x to 2.7.12
    • Affected Puppet version set to development

    Feature #12630: Run puppet periodically

    • Author: Josh Cooper
    • Status: Closed
    • Priority: Normal
    • Assignee: Josh Cooper
    • Category: windows

    The puppet msi should install puppet agent to run as a service. It should run as SYSTEM (aka LocalSystem) and abide by the runinterval specified in puppet.conf. It should be possible to pass arguments when starting the service. It should log somewhere so that failures to run can be debugged. It should not modify the system PATH environment variable (for ruby), as doing so would require a reboot. Since we know the location of where we installed puppet, we know where the ruby bin directory is, and can run from there.

    Reply all
    Reply to author
    Forward
    0 new messages