diff options
| author | jerome <jerome@xlinfo.fr> | 2022-09-13 01:26:13 +0200 |
|---|---|---|
| committer | jerome <jerome@xlinfo.fr> | 2022-09-13 01:26:13 +0200 |
| commit | 6556b78865d1e73279d5a2091470c3b0180aad0e (patch) | |
| tree | 76b44f9073b8b53add202ed916e9c33b469246e1 /createvm | |
| parent | e48fdf8a4c5ed73f13c9a8cdef9fe4916b9afd7f (diff) | |
| download | vbox-0.1.tar.gz vbox-0.1.zip | |
Revert "update tag 0.2"0.1
This reverts commit e48fdf8a4c5ed73f13c9a8cdef9fe4916b9afd7f.
Diffstat (limited to 'createvm')
| -rwxr-xr-x | createvm | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -8,21 +8,21 @@ count=1 # Déploiment terraform terraform init -reconfigure terraform plan -terraform apply -var "nb=$count" -var "start=$index" -auto-approve 2>/dev/null +terraform apply -var "nb=$count" -var "start=$index" -auto-approve echo -# On copie notre clé publique, on met à jour le hostname des machines, et on fixe les adresses ip données par le dhcp +# On copie notre clé publique et on met à jour le hostname des machines 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)" - 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/ - vboxmanage guestcontrol $vm --username vagrant --password vagrant run /usr/bin/bash /home/vagrant/network_config $vm $ip_addr + 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)" + vboxmanage guestcontrol $vm --username vagrant --password vagrant copyto id_rsa.pub /home/vagrant/.ssh/authorized_keys + vboxmanage guestcontrol $vm --username vagrant --password vagrant copyto set-hostname /home/vagrant/set-hostname + vboxmanage guestcontrol $vm --username vagrant --password vagrant run /usr/bin/bash /home/vagrant/set-hostname $vm done echo + |
