From 84b21fcecfde7e29287f9443670b80f6bdd1ed78 Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 15 Mar 2016 11:51:29 +0000 Subject: #739: Solucionar problema con idioma en el despliegue automático, definir instrucciones para definición del aula virtual, refinar la configuración y las instrucciones. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@4826 a21b9725-9963-47de-94b9-378ad31fedc9 --- installer/vagrant/Vagrantfile-devel-vbox | 112 +++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 installer/vagrant/Vagrantfile-devel-vbox (limited to 'installer/vagrant/Vagrantfile-devel-vbox') diff --git a/installer/vagrant/Vagrantfile-devel-vbox b/installer/vagrant/Vagrantfile-devel-vbox new file mode 100644 index 00000000..4406e8da --- /dev/null +++ b/installer/vagrant/Vagrantfile-devel-vbox @@ -0,0 +1,112 @@ +# 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 +wget -q http://opengnsys.es/svn/branches/version1.1/installer/opengnsys_installer.sh -O - | bash +echo y | sudo /opt/opengnsys/bin/setserveraddr eth1 +echo "New OpenGnsys local URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +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 +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, comentarios, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES (1, 'Aula virtual', 1, 'aula.jpg', 0, 'Aula virtual generada automáticamente en despligue 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 +EOT + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + # OpenGnsys Server VM definition. + config.vm.define "opengnsys", primary: true do |og| + # Specific VirtualBox configuration. + og.vm.provider "virtualbox" do |vb| + # VM name, memory and CPUs. + vb.name = "opengnsys" + vb.memory = SERVERMEM + vb.cpus = 1 + # Get VM disk path + line = `VBoxManage list systemproperties | grep "Default machine folder"` + vb_machine_folder = line.split(':')[1].strip() + second_disk = File.join(vb_machine_folder, vb.name, REPODISK) + # Create repo virtual disk, if needed. + unless File.exist?(second_disk) + vb.customize ['createhd', '--filename', second_disk, '--size', REPOSIZE * 1024] + end + # Attach repo virtual disk. + vb.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', second_disk] + end + # VM base and host name. + og.vm.box = "ubuntu/trusty64" + og.vm.hostname = "opengnsys" + # Network configuration: forward web port and attach new interface to VMs private network. + og.vm.network "forwarded_port", guest: 443, host: 8443 + og.vm.network "private_network", ip: "#{NETPREFIX}10", virtualbox__intnet: true + # Disable synced folder. + og.vm.synced_folder ".", "/vagrant", disabled: true + # Launch provisioning script. + og.vm.provision "shell", inline: OGSERVERSCRIPT + end + + # Client 1 VM definition. + config.vm.define "virt1", autostart: false do |v1| + v1.vm.box = "ubuntu/trusty64" + v1.vm.hostname = "virt1" + v1.vm.network "private_network", mac: "#{MACPREFIX}01".tr(":",""), type: "dhcp", virtualbox__intnet: true + v1.vm.provider "virtualbox" do |vb| + vb.name = "virt1" + vb.memory = CLIENTMEM + vb.cpus = 1 + vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] + end + v1.vm.synced_folder ".", "/vagrant", disabled: true + v1.vm.provision "shell", inline: "echo 'After now, use VirtualBox GUI to shutdown this VM, disable its network interface 1 and work whit it.'" + end + + # Client 2 VM definition. + config.vm.define "virt2", autostart: false do |v2| + v2.vm.box = "clink15/pxe" + v2.ssh.insert_key = false + v2.vm.boot_timeout = 5 + v2.vm.network "private_network", mac: "#{MACPREFIX}02".tr(":",""), type: "dhcp", virtualbox__intnet: true + v2.vm.provider "virtualbox" do |vb| + vb.name = "virt2" + vb.memory = CLIENTMEM + vb.cpus = 1 + vb.customize ['modifyvm', :id, '--boot1', 'net', '--boot2', 'disk'] + vb.customize ["modifyvm", :id, "--nic1", "none"] + end + end + +end + -- cgit v1.2.3-18-g5258