Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In DevOps Last updated: November 30, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Installing Puppet Bolt on Ubuntu…

Puppet Bolt is an open-source tool which is widely used to automate the manual work.

YouTube video

Bolt is based on Ruby and its command-line tool which get execute scripts, command on a local and remote server over SSH and WinRM. It helps Sysadmin to manage multiple servers in many ways.

  • Manage updates
  • Software installation
  • Logs reading
  • Stop or start services
  • Command execution

The good news is you don’t need to install any agent on the servers. It’s agentless.


The following example is on Ubuntu so you need a Ubuntu VM with sudo access to root.

Update System

We highly recommend you to upgrade all the available repository and package before installing any new package on the system. Execute the following command and it’ll do the job for you.

sudo apt-get update

Installing Puppet Bolt

Since its agentless, you don’t need to install on every server. Instead, just on one server which will act as a master which can be used to connect to remote servers. Bolt is a multi-platform tool so you can install on your favorite OS.

  • Windows
  • macOS
  • RHEL
  • CentOS
  • Fedora
  • Debian
  • Ubuntu

Refer to the official site for the latest available version. Let’s get this installed on Ubuntu.

Run the following command to get the package.

sudo wget

Next, install the above-downloaded package using the Debian package manager command.

sudo dpkg -i puppet6-release-bionic.deb

Again, update the system using the following command.

sudo apt-get update

Finally, execute the following command to install the bolt.

sudo apt-get install puppet-bolt

You have successfully installed puppet bolt on your server.

This needs to be done on all the servers which you want to manage through Bolt.

As mentioned earlier, Bolt connects to another server over SSH key so I assume you already have key exchanged between servers. If not, you can refer this guide to setup SSH key exchange.

Let’s connect to remote servers and run bolt commands.

To run a command on a single node use the following command.

bolt command run <COMMAND> --nodes <NODE>

Please replace the COMMAND with the command you want to execute and NODE with the remote server’s hostname or IP. Similarly, you can also run a command on multiple nodes.

bolt command run <COMMAND> -n <NODE1,NODE2,NODE3,NODE4>

If in case you need to add password authentication to a command then you can add it using the flags.

bolt command run <COMMAND> -n <NODE1,NODE2> -u <USER> -p <PASSWORD>

Suppose you want to see how long system has been running then you will need to use `uptime` command like this:

bolt command run uptime --nodes,

You should see the following output.

sajid@Sajid-PC:~$ bolt command run uptime --nodes,
Started on
Started on
Finished on
04:57:48 up 7 min, 0 users, load average: 0.00, 0.03, 0.02
Finished on
04:57:48 up 9 min, 0 users, load average: 0.00, 0.00, 0.00
Successful on 2 nodes:,
Ran on 2 nodes in 5.96 seconds

It may possible that you want to run some command that contains the spaces so you’ll need to wrap the command in single quotation marks:

sajid@Sajid-PC:~$ bolt command run 'echo $HOME' --nodes,
Started on
Started on
Finished on
Finished on
Successful on 2 nodes:,
Ran on 2 nodes in 6.11 seconds

Running Scripts

We all have a set of scripts that we use regularly.

Bolt makes it easy to reuse those script without any modification and run them on even more nodes simultaneously. All you need to do is specify the name and path of the script that you want to run.

bolt script run <PATH/TO/SCRIPT> --nodes <NODE1,NODE2,NODE3,NODE4>
bolt script run /home/sajid/Desktop/ --nodes,

You should see the output something similar to this:

sajid@Sajid-PC:/$ bolt script run /home/sajid/Desktop/ --nodes,
Started on
Started on
Finished on
Hello World
Finished on
Hello World
Successful on 2 nodes:,
Ran on 2 nodes in 15.18 seconds

You can run scripts in any language as long as the appropriate interpreter is installed on the remote system.

Automation with Task

The task is a set of actions that you want to run on remote machines.

Tasks can be written in any language that runs on a remote node. Tasks make it easy to reuse and share scripts and helps you to achieve automation. You can download some existing tasks from Puppet forge and upload your tasks there as per your need.

For example, if you want to check the status of the vim package then you can use the following command.

bolt task run package action=status name=vim --nodes,

You will see the output similar to this:

sajid@Sajid-PC:~$ bolt task run package action=status name=vim --nodes,
Started on
Started on
Finished on
"status": "install ok installed",
"version": "2:7.4.1689-3ubuntu1.3"
Finished on
"status": "install ok installed",
"version": "2:7.4.1689-3ubuntu1.3"
Successful on 2 nodes:,
Ran on 2 nodes in 19.15 seconds

If you don’t find the vim package installed then you can install it using the following command.

bolt task run package action=install name=vim --nodes,

You can run plan to set up nodejs and connect it to your load balancer, you might do this by combining Puppet Bolt with a target node that already has the Bolt installed.

bolt plan run nodejs::myplan

You can use puppet bolt to copy files on remote nodes. You can simply upload the file or directory to the remote node using the `bolt file upload` command. All you have to do is specify the path of the file on the local machine and destination on remote node.

bolt file upload <SOURCE> <DESTINATION> --nodes <NODE1>

You can upload a file on multiple remote nodes simultaneously like this:

bolt file upload sample_file.txt /tmp/remotesample_file.txt --nodes,

A lot of possibilities as you can see.

Creating an Inventory file

Bolt allows you to create an inventory file that will store information about your nodes, tasks, and, configuration. You can specify different nodes in a group and the inventory file by default stored at inventory.yaml inside the project directory. Here is an example of creating an inventory file.

# Example Inventory file
- name: Group of nodes
- node1
- node2
- node3
host-key-check: false
ssl: false

You can replace these node1, node2, node3 with your actual node domain name or the IP address of your nodes. You can now add this inventory file into the bolt commands to execute tasks on the specified nodes.

bolt command run <COMMAND> --inventoryfile ./inventory.yaml


I hope by now you have an idea about what Bolt is and how it can help you with the automation. You may also be interested in learning about Puppet.

  • Sajid Qureshi
Thanks to our Sponsors
More great readings on DevOps
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder