Bolt can run Puppet tasks on remote nodes without requiring any Puppet infrastructure. 

To execute a task, run bolt task run, specifying:

  • The full name of the task, formatted as <MODULE::TASK>, or as <MODULE> for a module's main task (the init task).

  • Any task parameters, as parameter=value.

  • The nodes on which to run the task and the connection protocol, with the --nodes flag.

  • If credentials are required to connect to the target node, the username and password, with the --user and --password flags.

For example, to run the sql task from the mysql module on node named neptune:

bolt task run mysql::sql database=mydatabase sql="SHOW TABLES" --nodes neptune --modulepath ~/modules

To run the main module task defined in init, refer to the task by the module name only. For example, the puppetlabs-package module contains only one task, defined as init, but this task can execute several actions. To run the status action from this module to check whether the vim package is installed, you run:

bolt task run package action=status name=vim --nodes neptune --modulepath ~/modules
Tip: Bolt is packaged with a collection of modules that contain useful plans to support common workflows. For details, see Packaged modules.

Passing structured data

If one of your task or plan parameters accept structured data like an array or hash, it can be passed as JSON from the command line.

If a single parameter can be parsed as JSON and the parsed value matches the parameter's type specification in the task metadata or plan definition, it can be passed with <>param=value syntax. Make sure to wrap the JSON value in single quotes to prevent " characters from being swallowed by the shell.
bolt task run mymodule::mytask --nodes load_balancers='["", ""]'
bolt plan run mymodule::myplan load_balancers='["", ""]'
If you want to pass multiple structured values or are having trouble with the magic parsing of single parameters, you can pass a single JSON object for all parameters with the --params flag.
bolt task run mymodule::mytask --nodes --params '{"load_balancers": ["", ""]}'
bolt plan run mymodule::myplan --params '{"load_balancers": ["", ""]}'
You can also load parameters from a file by putting @ before the file name.
bolt task run mymodule::mytask --nodes --params @param_file.json
bolt plan run mymodule::myplan --params @param_file.json
To pass JSON values in PowerShell without worrying about escaping, use ConvertTo-Json
bolt task run mymodule::mytask --nodes --params $(@{[email protected]("","")} | ConvertTo-Json)
bolt plan run mymodule::myplan --nodes --params $(@{[email protected]("","")} | ConvertTo-Json)

Specifying the module path

In order for Bolt to find a task or plan, the task or plan must be in a module on the modulepath. By default, the modulepath includes modules/ and site-modules/ directories inside the Bolt project directory.

If you are developing a new plan, you can specify --modulepath <PARENT_DIR_OF/MODULE> to tell Bolt where to load the module. For example, if your module is in ~/src/modules/my_module/, run Bolt with --modulepath ~/src/module. If you often use the same modulepath, you can set modulepath in bolt.yaml.

Back to top
The page rank or the 1 our of 5 rating a user has given the page.
The email address of the user submitting feedback.
The URL of the page being ranked/rated.