All things DevOps

Runner Reminder

Runner is a command line tool for running commands on thousands of devices that support SSH. I wrote Runner and use it every single day, because unlike Ansible, Runner truly has no dependencies on the client or server side other than SSH. I have used Runner to build entire datacenters, so it is proven and tested and has a lot of well thought out features, which brings me to todays post. Since I initially debuted Runner I have added a lot of features, but I had yet to check them into github, until now. Here is a run down of Runner’s features.

Features

Runner can be used through a bastion/jump host via an SSH tunnel (see prunner.py)

Runner reads it’s main host list from a file ~/.runner/hosts/hosts-all

Runner can accept custom hosts lists via -f

-e can be used to echo a command before it is run, this is useful for running commands on F5 load balancers for example, when no output is returned on success.

-T will allow you to tune the number of threads, but be careful you can easily exhaust your system or site resources (I.E. do NOT DOS your LDAP authentication servers by trying to do hundreds of threads across thousands of machines, unless you know they can handle it 😉 ).

-s is for sudo for those users who have permissions in the sudoers file.

-1 reduces any host list down to one host per pool. It uses a regex, which you will likely have to modify for your own host / device naming standard.

-r can be used to supply a regular expression for matching hosts. Remember sometimes you have to quote the regex and/or escape the shell when using certain characters.

-c will run a single command on many hosts, but -cf will run a series of commands listed in a file on any hosts specified. This is particularly useful for automations. For example, I used it to build out load balancer virtuals and pools on an F5.

-p enables you to break apart the number of hosts to run at a time using a percentage. This is a handy & more humanized way to ensure you do not kill your machine or the infrastructure you are managing when you crank threads through the roof 😉

Now that I have taken the time to explain some of those cool features, here’s an example of what it looks like in action.

Runner Demo

Host List

1

2

3

4

5

6

➜~runner-l-rtuxlabs

tuxlabs.com

old.tuxlabs.com

There were2hosts listed.

➜

Basic Run Using Only -c, -u and defaults

Note: User defaults to the user you are logged in as if you don’t specify -u . Since I am logged in as ‘jriedel’ I have specified the user tuxninja instead.