# Vagrantfile to install OpenGnsys 1.1 virtual environment using VirtualBox provider. VAGRANTFILE_API_VERSION = "2" # VM provider: Oracle VM VirtualBox. ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" # Language. LANGUAGE = "es_ES" ENV['LC_ALL'] = LANGUAGE + ".UTF-8" # Repository virtual disk: file and size (GB). REPODISK = "repo.vdi" REPOSIZE = 50 # Amount of memory for server and clients (MB) SERVERMEM = 1024 CLIENTMEM = 512 # Clients MAC address prefix. MACPREFIX = "08:00:27:0E:65:" NETPREFIX = "192.168.50." # Local port to access OpenGnsys Server. LOCALWEBPORT = 8443 # OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. OGSERVERSCRIPT = <> /etc/fstab mount -a # Install OpenGnsys and change server address. wget -q http://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O - | bash echo y | sudo /opt/opengnsys/bin/setserveraddr eth1 # Insert DHCP data. sed -i '/^}/d' /etc/dhcp/dhcpd.conf echo " host virt1 { hardware ethernet #{MACPREFIX}01; fixed-address #{NETPREFIX}101; } host virt2 { hardware ethernet #{MACPREFIX}02; fixed-address #{NETPREFIX}102; } }" >> /etc/dhcp/dhcpd.conf service isc-dhcp-server restart # Set language. export LANG="#{LANGUAGE}.UTF-8" echo "LANG=\"$LANG\"" > /etc/default/locale locale-gen --lang #{LANGUAGE} # Unmcomment next lines for automatic data insertion. #mysql -u usuog -ppassusuog -D ogAdmBD -e "INSERT INTO aulas (idaula, nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES (1, 'Aula virtual', 1, 'aula.jpg', 0, 'Despligue virtual con Vagrant.', 5, 2, '239.194.50.101', 9000, 70, '#{NETPREFIX}1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (idordenador, nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES (1, 'virt1', '#{NETPREFIX}101', REPLACE('#{MACPREFIX}01',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif'), (2, 'virt2', '#{NETPREFIX}102', REPLACE('#{MACPREFIX}02',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif');" #/opt/opengnsys/bin/setclientmode ogAdmin virt1 1 #/opt/opengnsys/bin/setclientmode ogClient virt2 1 echo "New OpenGnsys local URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" EOT # Client 1 OS provisioning script. MODELSCRIPT = <