Skip to content

Instantly share code, notes, and snippets.

@elarif
Created May 23, 2016 19:26
Show Gist options
  • Save elarif/02bd2778271c4dd5bd22afe9194f5fc1 to your computer and use it in GitHub Desktop.
Save elarif/02bd2778271c4dd5bd22afe9194f5fc1 to your computer and use it in GitHub Desktop.
# start multiple virtualbox vm headless
for i in vm1 vm2 vm3 ; do VBoxManage startvm $i --type headless; done
# get ip address for multiple vm
# TODO put them in an array
for i in vm1 vm2 vm3 ; do VBoxManage guestproperty get $i "/VirtualBox/GuestInfo/Net/0/V4/IP"; done
# copy ssh key to multiple vm
for i in vm1 vm2 vm3 ; ; do ssh-copy-id -i ~/.ssh/id_rsa.pub root@$i; done
# remove ip from known_hosts
# TODO read it from array
for i in 10 11 12 13 14; do ssh-keygen -R 192.168.1.$i: done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment