homebloguse boltwash to interact with your bolt targets and their filesystems

Use Boltwash to interact with your Bolt targets and their filesystems

If you're not using Bolt, check it out.

If you are using Bolt, we’ve created the Boltwash plugin that lets you navigate your inventory. Let's check it out:

Wash is a UNIX-like shell that lets you manage your infrastructure as files and directories. It ships with support for AWS, Docker, Kubernetes, and GCP resources, but can easily be extended to talk to other things via its external plugin interface. Boltwash is one such external plugin.

Exploring Boltwash

As you can see, the Bolt plugin organizes Bolt targets as groups. It also mounts something called fs (a view of the filesystem on that target). Let's explore it a bit more.

I have an inventory setup organizing some machines according to where they run. Your groups can be organized however you like. The all group will appear for everyone; it contains all targets in your inventory (it's an implicit group that can be used in Bolt). Let's explore a particular target.

Great — I can see the files on that system, and I didn't have to do any additional setup. I can go look at config or watch logs.

We can also explore Windows targets using WinRM:

Boltwash includes target configuration as metadata, so you can also view that.

And you can use find to search for nodes based on that metadata.

Debugging with Bolt + Wash

Wash can be helpful debugging all sorts of failures. As an example, suppose you have a cluster of machines (in the webservers group) that are having problems:

You've noticed an issue in one of their logs, and you want to see if it's present everywhere:

You can see that they're all experiencing these issues. Let's see where the server process is still running:

It looks like they've restarted recently, and the server's not running on server3. Let's reconfigure the servers to allow more memory (using Bolt or by directly modifying config/service files) and restart them.

You can imagine other scenarios as well. Suppose you ran a Bolt plan across several targets and want to get some files back from them. You can use Wash to directly copy them with something like:

The Bash string manipulation (${f//\//_}) replaces all slashes in the original path to the file with underscores to make it unique.

Configuring Boltwash

Boltwash loads the default Boltdir at ~/.puppetlabs/bolt, but you can configure it to load any Boltdir in Wash's config. To use Boltwash, you add it to the external-plugins key in ~/.puppetlabs/wash/wash.yaml; adding a custom Boltdir location looks like:

The Bolt plugin for Wash provides an accessible, interactive means of investigating multiple systems. Combined with Bolt inventory, it's natural to then take action with Bolt. Try it out!