In scripts we use for some ESXi hypervisor configurations we utilize “allssh”. The problem I’m running in to, though, is I must run each allssh command individually rather than using a script to run multiple allssh commands. The first line will kick off and before it has a chance to complete the second will kick off. For example, here’s where we configure DNS on the hypervisor through a CVM:
allssh ssh email@example.com esxcli network ip dns server add --server=10.1.1.1
allssh ssh firstname.lastname@example.org esxcli network ip dns server remove --server=184.108.40.206
allssh ssh email@example.com esxcli network ip dns server add --server=10.1.1.2
The first will kick off then the second goes prior to the first completing. The script then gets confused and stops while still connected to one of the ESXi hosts. Does anyone know of a way to initiate subsequent allssh commands only after the prior one running has completed? Although not very clean, should I put a sleep command in between each?
Best answer by perkinsa
We also have a hostssh command, a wrapper for the above for statement.
You can run it on all hosts with the following syntax.
hostssh 'esxcli network ip dns server add -s 10.1.1.1; esxcli network ip dns server remove -s 220.127.116.11; esxcli network ip dns server add --server=10.1.1.2'