diff options
| author | jerome <jerome@xlinfo.fr> | 2022-09-13 08:13:47 +0000 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2022-09-13 08:13:47 +0000 |
| commit | 6ec868c221a183f929d44d93693c6eb576f6bfe8 (patch) | |
| tree | 3853058c9cf54f5d16cb08c2fea9a2d3785cd59b /createvm | |
| parent | 9046073916438b81169634142ba5db67ea9755f4 (diff) | |
| download | vbox-6ec868c221a183f929d44d93693c6eb576f6bfe8.tar.gz vbox-6ec868c221a183f929d44d93693c6eb576f6bfe8.zip | |
Update createvm0.3
Diffstat (limited to 'createvm')
| -rwxr-xr-x | createvm | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -15,11 +15,15 @@ echo # On copie notre clé publique, on met à jour le hostname des machines, et on fixe les adresses ip données par le dhcp for ((i=$index;i<$((index+count));i++));do vm=ubuntu$i - while vboxmanage guestproperty get $vm /VirtualBox/GuestInfo/Net/0/V4/IP |grep -q "No value"; do - sleep 5 - echo "Wait VM until ready..." - done - echo -e "\n [$vm ip] $(vboxmanage guestproperty get $vm /VirtualBox/GuestInfo/Net/0/V4/IP)" + # si terraform apply timeout, on attend que la machine ait une adresse ip + if [ "$timeout" == 1 ] ; then + while vboxmanage guestproperty get $vm /VirtualBox/GuestInfo/Net/0/V4/IP |grep -q "No value"; do + sleep 5 + echo "Wait VM until ready..." + done + # on affiche l'adresse ip (pas de terraform output) + echo -e "\n [$vm ip] $(vboxmanage guestproperty get $vm /VirtualBox/GuestInfo/Net/0/V4/IP)" + fi ip_addr=$(vboxmanage guestproperty get $vm /VirtualBox/GuestInfo/Net/0/V4/IP|cut -d ':' -f2) vboxmanage guestcontrol $vm --username vagrant --password vagrant copyto id_rsa.pub /home/vagrant/.ssh/authorized_keys vboxmanage guestcontrol $vm --username vagrant --password vagrant copyto network_config /home/vagrant/ |
