How to save a search filter in Rundeck

Rundeck offers many features, like search filters, to make a systems administrator's job significantly easier.

How to create, use, and save a search filter in Rundeck Rundeck offers a ton of features to make a systems administrator's job significantly easier. One feature is search filters. Jack Wallen shows you how to create and use them.

With Rundeck up and running, your nodes added, and commands at your fingertips, it's time to make the tool a bit more efficient. You might have a good number of nodes added, so when running commands you find yourself searching for specific nodes to run those commands, one node at a time. This can be a waste of time, especially if the number of nodes grows to data center levels.

What do you do to make this task more expedient? You save search filters. By using this tool you can group your servers in such a way as to run commands on all your web servers or database servers, location specific, or network-specific servers, etc. That's what's so great about Rundeck—it provides the flexibility to make your tasks as easy as you want them.

I will walk you through the process of creating search filters on Rundeck. All you need is an instance of Rundeck up and running and nodes added to the server (How to install Rundeck local and remote services controller on Ubuntu 18.04 and How to run a command in Rundeck).

SEE: Disaster recovery and business continuity plan (Tech Pro Research)

Creating a search filter

This is one of those features that could drive you a bit mad trying to find. If you go to either the Jobs or the Commands page, you can search for Nodes or filters. However, creating a filter isn't quite as obvious. Try this:

  1. Go to one of your Projects.
  2. Click on the Nodes option in the left navigation.
  3. Click the Nodes dropdown and select Show all nodes.
  4. Click the Actions dropdown.

As you can see (Figure A), you only have the option to set the Show all nodes as the Default Filter. Go ahead and do that, because it's a good filter to have (if you want to run specific commands to all of your associated nodes).

Figure A

Figure A: Show all nodes as a default filter.

But how do you create a specific filter? In my example, there only two nodes added (besides localhost being the Rundeck server). Those nodes are HIVE and hive4. Say you want to create a filter specific to those machines. To do that, enter the following in the Search field:

HIVE, hive4

Once the search text has been entered, hit the Search button and those two machines will be listed. Now, click the Actions dropdown and click Save Filter (Figure B).

Figure B

Saving our new filter.


In the resulting popup window (Figure C), give the search a name and click Save Filter.

Figure C

Figure C: Saving a new filter with a specific name.

Using the new filter

Now that you created a new filter, how do you use it? Simple. Say you want to run the same command on all of the nodes in the filter named "hives." To do this, click Projects | Commands and then click the Nodes drop-down. You should see the newly-created filter listed (Figure D). Select the new filter and all associated nodes will populate, ready to receive their commands.

Figure D

Figure D: Selecting the newly-created filter.

Type your command in the commands space and then click Run on X Nodes (where X is the number of nodes associated with the selected filter). The command will be sent to all nodes in the filter for execution.

Get creative

And that's how you make use of search filters with Rundeck. With the smallest amount of creativity, you can group nodes together in such a way as to make your Linux data center administration job incredibly easy. And, to make filters even more powerful, it can also be applied when creating jobs.

Also see

rundeckhero.jpg
Image: Jack Wallen

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.