Running Puppet commands on Windows
Puppet was originally designed to run on *nix systems, so its commands generally act the way *nix admins expect. Since Windows systems work differently, there are a few extra things to keep in mind when using Puppet commands.
Supported commands
Not all Puppet
commands work on Windows. Notably,
Windows nodes can’t run the
puppet master
or
puppet cert
commands.
Running Puppet's commands
The installer adds Puppet commands to the PATH. After installing, you can run them from any command prompt (cmd.exe) or PowerShell prompt.
Open a new command prompt after installing. Any processes that were already running before you ran the installer will not pick up the changed PATH value.
Running with administrator privileges
You usually want to run Puppet’s commands with administrator privileges.
On *nix
systems, Puppet defaults to running
with limited privileges, when not run by root
, but can have its privileges raised with the
standard sudo command.
Windows systems don’t use sudo, so escalating privileges works differently.
Newer versions of Windows manage security with User Account Control (UAC), which was added in Windows 2008 and Windows Vista. With UAC, most programs run by administrators will still have limited privileges. To get administrator privileges, the process has to request those privileges when it starts.
To run Puppet's commands in adminstrator mode, you must first start a Powershell command prompt with administrator privileges.
The Puppet Start menu items
Puppet’s installer adds a folder of shortcut items to the Start Menu.
These items aren’t necessary for working with Puppet, since puppet agent runs a normal Windows service and the Puppet commands work from any command or PowerShell prompt. They’re provided solely as conveniences.
- Run Facter
- This shortcut requests UAC elevation and, using the CLI, runs Facter with administrator privileges.
- Run Puppet agent
- This shortcut requests UAC elevation and, using the CLI, performs a single Puppet agent command with administrator privileges.
- Start Command Prompt with Puppet
- This shortcut starts a normal command prompt with the
working directory set to Puppet's program directory. The CLI window
icon is also set to the Puppet logo. This shortcut was particularly
useful in previous versions of Puppet, before Puppet's commands were added to the PATH at
installation time.Note: This shortcut does not automatically request UAC elevation; just like with a normal command prompt, you'll need to right-click the icon and choose Run as administrator.
Configuration settings
Configuration settings can be viewed and modified using the CLI.
To get configuration settings, run: puppet agent --configprint <SETTING>
To set configuration settings, run: puppet config set <SETTING VALUE> --section
<SECTION
>
When running Puppet commands on Windows, note the following:
The location of
puppet.conf
depends on whether the process is running as an administrator or not.Specifying file owner, group, or mode for file-based settings is not supported on Windows.
The
puppet.conf
configuration file supports Windows-style CRLF line endings as well as *nix-style LF line endings. It does not support Byte Order Mark (BOM). The file encoding must either be UTF-8 or the current Windows encoding, for example, Windows-1252 code page.Common configuration settings are
certname
,server
, andruninterval
.You must restart the Puppet agent service after making any changes to Puppet’s
runinterval
config file setting.