Skip to content

Instantly share code, notes, and snippets.

@markwragg
Last active June 5, 2018 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwragg/c037f3656fe1e7229e85d43d73c2b506 to your computer and use it in GitHub Desktop.
Save markwragg/c037f3656fe1e7229e85d43d73c2b506 to your computer and use it in GitHub Desktop.
A PowerShell function to invoke Puppet after it has completed its current run
Function Invoke-Puppet {
Param(
$Environment
)
if ($Environment) { $Environment = "--environment='$Environment'" }
while (Test-Path C:/ProgramData/PuppetLabs/puppet/cache/state/agent_catalog_run.lock) {
Write-Warning 'Puppet is already running. Waiting for it to finish..'
Start-Sleep 5
}
puppet agent -t $Environment
}
Invoke-Puppet -Env dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment