Run Puppet on demand from the CLI
Use the puppet job run
command to start an on-demand
Puppet run to enforce changes on your agent
nodes.
Use the puppet job run
command to immediately enforce
change across nodes, rather than waiting for the next scheduled Puppet run. For example, if you add a new class parameter
to a set of nodes, or if you deploy code to a new Puppet
environment, you might want to use this command to run Puppet across all the nodes in the impacted
environment.
puppet job run
command, you can
select one, and only one, of these targets:- A list of one or more specific nodes, identified by certname.
- A node group, identified by node group ID.
- A Puppet Query Language (PQL) query defining a set of nodes.
The first time you run a command, you need to authenticate. For details, refer to Setting PE RBAC permissions and token authentication for orchestrator.
If you're running this command from a managed or non-managed Windows workstation, you must specify the full path to the
command. For example: c:\Program Files\Puppet Labs\Client\bin\puppet-task
run
Run Puppet on one or more specific nodes
An orchestrator job can target one or more specific nodes, identified by certname. This is useful if you want to run Puppet on a single node, a few specific nodes, nodes that are not in the same node group, or nodes that can't easily be identified by a PQL query.
Make sure you have the permissions necessary to run jobs.
Make sure you have access to the nodes you want to target.
When you execute the puppet job run
command, the orchestrator generates
a job ID for the job, shows you a list of nodes targeted by the job, and proceeds to run
Puppet on the targeted nodes in the appropriate order.
Puppet compiles a new catalog for all nodes targeted
by the job.
To view the job status, run: puppet job show <JOB_ID>
To view a list of the 50 most-recent running and completed jobs, run: puppet job
show
Run Puppet on a PQL query
An orchestrator job can target a set of nodes based on a PQL query. This is useful when you want to target a variable set of nodes that meet specific conditions, such as a particular operating system. When you supply a PQL query, the orchestrator runs the job on a list of nodes generated by the PQL query.
Make sure you have access to the nodes you want to target.
Make sure you have the permissions necessary to run jobs and PQL queries.
When you execute the puppet job run
command, the orchestrator generates
a job ID for the job, shows you a list of nodes targeted by the job, and proceeds to run
Puppet on the targeted nodes in the appropriate order.
Puppet compiles a new catalog for all nodes targeted
by the job.
To view the job status, run: puppet job show <JOB_ID>
To view a list of the 50 most-recent running and completed jobs, run: puppet job
show
Run Puppet on a node group
An orchestrator job can target all nodes in a specific node group, identified by node group ID.
Make sure you have the permissions necessary to run jobs.
Make sure you have access to the nodes you want to target.
When you execute the puppet job run
command, the orchestrator
generates a job ID for the job, shows you a list of nodes targeted by the job, and
proceeds to run Puppet on the targeted nodes in the
appropriate order. Puppet compiles a new catalog for
all nodes targeted by the job.
To view the job status, run: puppet job show <JOB_ID>
To view a list of the 50 most-recent running and completed jobs, run: puppet
job show
puppet job
run
command options
You might want to use these options with the puppet job run
command.
Alternately, use puppet job --help
to get a complete list of options you
can use with puppet job
commands.
Option | Description |
---|---|
--noop |
A flag indicating whether to run the job in no-op mode. No-op mode
simulates changes from a new catalog without actually enforcing the
changes. Excluding this option assumes noop =
false , unless noop is
specified elsewhere, such as the agent's puppet.conf file.Cannot be used in conjunction with
|
--no-noop |
A flag indicating whether to run the job in enforcement mode and
enforce a new catalog on all targeted nodes. This flag overrides
noop = true if set in the agent's
puppet.conf file. Cannot be used in conjunction
with --noop . |
--environment or -e
|
Supply an environment name, as a string, to override the environment specified in the orchestrator configuration file. The orchestrator uses this option to tell nodes which environment to run the job in. If any nodes can’t run in the specified environment, those node runs fail. A node can run in an environment as long as it is classified into that environment in the PE node classifier. |
--no-enforce-environment |
A flag indicating whether you want the job to ignore the environment
set by the --environment flag. When you use this flag,
agents run in the environment specified by the PE Node Manager or their
puppet.conf files. |
--description |
Supply a description of the job, as a string. The description appears
on the job list and job details pages, and it is returned when you use
the puppet job show command. |
--concurrency |
Supply an integer specifying the maximum number of nodes to run at one time. The default is an unlimited number of nodes. You can also configure concurrent compile requests in the console. |
Post-run node status
After a Puppet run, the orchestrator returns a list of targeted nodes and their run statuses.
in progress
, completed
, skipped
, or failed
.- For
completed
runs, the orchestrator prints the configuration version, the transaction ID, a summary of resource events, and a link to the full node run report in the console. - For
in progress
runs, the orchestrator prints the elapsed time, in seconds, since the run started. - When there is a
failed
run, subsequent or related runs might beskipped
. Forfailed
runs, the orchestrator prints an error message indicating why the run failed, a list of applications that were affected by the failure, and any applications that were affected by skipped node runs.
Use puppet job show
to see a list of the 50 most-recent in progress
, completed
, and failed
jobs.
In the console, on the Jobs page, you can review a list of jobs and to view job details for previous or in-progress jobs.
Stop an in-progress job
You can stop a job if, for example, you need to reconfigure a class or push a configuration change that the job needs. When you stop a Puppet job, in-progress jobs finish, and jobs that aren't started are canceled.
- In the console, go to Jobs, switch to the Puppet run tab, locate the job you want to stop, and click Stop.
- If you started the job on the command
line, press
CTRL + C
.