As system administrators and software engineers we are often times required to run a series of commands or scripts across our fleet of systems. Depending on your environment you may have restrictions due to policies, regulations or the tools at your disposal.
We generally use ansible for running remote commands however if we need to leave an audit trail behind or respect specific regulations or policies we find it much easier to use rundeck ad-hoc commands (which in turn may use ansible to run the actual commands).
Here is a quick example of running a series of commands using rundeck to filter on the distribution and vendor (hypervisor in our case):
From there we can save the search for future use or run one or more commands on all of our nodes.
The cool thing about rundeck ad-hoc commands is that it is easy to compose the list of systems (targets) using tags, regex searches, etc. and we have a complete auditable log of the commands and of course the result of those commands.
Hope this two minute tip can help you get things done quickly and safely when you need to run commands across one or more systems.
Two minute tips are inspired by David Allens Two minute tips for turbulent times.