Parallel bash function call
Introduction
Now that we can execute bash functions remotly, we can scale the execution using GNU Parallel.
When one wants to make a change or retrieve one particular piece of information on a whole set of machines, multiple choice are available (ansible, puppet, pssh, consul, ...) each with their own upsides and downsides.
Parallel + ssh + func can give a combination of upsides that I haven't seen elsewhere:
- No prerequisite on remote machine
- Minimum requisite on local machine (bash, ssh, parallel)
- Blazing fast thanks to parallel
- Use plain bash, no new DSL or weird escaping
- Use shell tools that you already know
For example in fifteen seconds we're able to retrieve 1448 host kernel versions:
{ | ; }
) | | |
Where
You can find an helper functions here: shell_utils, you need to copy the functions into your ~/.bash_aliases
.