|
| 1 | +# -*- mode: ruby -*- |
| 2 | +# vi: set ft=ruby : |
| 3 | + |
| 4 | +# Variables |
| 5 | +var_box = 'oraclebase/fedora-42' |
| 6 | +var_vm_name = 'f42_19' |
| 7 | +var_mem_size = 6144 # More would be better. |
| 8 | +var_cpus = 2 |
| 9 | +var_non_rotational = 'on' # SSD |
| 10 | +var_disk1_name = './f42_19_u01.vdi' |
| 11 | +var_disk2_name = './f42_19_u02.vdi' |
| 12 | +var_disk_size = 100 |
| 13 | +var_public_ip = '192.168.56.140' |
| 14 | + |
| 15 | +# All Vagrant configuration is done below. The "2" in Vagrant.configure |
| 16 | +# configures the configuration version (we support older styles for |
| 17 | +# backwards compatibility). Please don't change it unless you know what |
| 18 | +# you're doing. |
| 19 | +Vagrant.configure("2") do |config| |
| 20 | + # The most common configuration options are documented and commented below. |
| 21 | + # For a complete reference, please see the online documentation at |
| 22 | + # https://docs.vagrantup.com. |
| 23 | + |
| 24 | + # Every Vagrant development environment requires a box. You can search for |
| 25 | + # boxes at https://vagrantcloud.com/search. |
| 26 | + config.vm.box = var_box |
| 27 | + |
| 28 | + # Disable automatic box update checking. If you disable this, then |
| 29 | + # boxes will only be checked for updates when the user runs |
| 30 | + # `vagrant box outdated`. This is not recommended. |
| 31 | + # config.vm.box_check_update = false |
| 32 | + |
| 33 | + # Create a forwarded port mapping which allows access to a specific port |
| 34 | + # within the machine from a port on the host machine. In the example below, |
| 35 | + # accessing "localhost:8080" will access port 80 on the guest machine. |
| 36 | + # NOTE: This will enable public access to the opened port |
| 37 | + # config.vm.network "forwarded_port", guest: 80, host: 8080 |
| 38 | + config.vm.network "forwarded_port", guest: 1521, host: 1521 |
| 39 | + config.vm.network "forwarded_port", guest: 5500, host: 5500 |
| 40 | + |
| 41 | + # Create a forwarded port mapping which allows access to a specific port |
| 42 | + # within the machine from a port on the host machine and only allow access |
| 43 | + # via 127.0.0.1 to disable public access |
| 44 | + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" |
| 45 | + |
| 46 | + # Create a private network, which allows host-only access to the machine |
| 47 | + # using a specific IP. |
| 48 | + config.vm.network "private_network", ip: var_public_ip |
| 49 | + |
| 50 | + # Create a public network, which generally matched to bridged network. |
| 51 | + # Bridged networks make the machine appear as another physical device on |
| 52 | + # your network. |
| 53 | + # config.vm.network "public_network" |
| 54 | + |
| 55 | + # Share an additional folder to the guest VM. The first argument is |
| 56 | + # the path on the host to the actual folder. The second argument is |
| 57 | + # the path on the guest to mount the folder. And the optional third |
| 58 | + # argument is a set of non-required options. |
| 59 | + # config.vm.synced_folder "../data", "/vagrant_data" |
| 60 | + |
| 61 | + # Provider-specific configuration so you can fine-tune various |
| 62 | + # backing providers for Vagrant. These expose provider-specific options. |
| 63 | + # Example for VirtualBox: |
| 64 | + # |
| 65 | + config.vm.provider "virtualbox" do |vb| |
| 66 | + vb.memory = var_mem_size |
| 67 | + vb.cpus = var_cpus |
| 68 | + vb.name = var_vm_name |
| 69 | + |
| 70 | + vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', '0', '--nonrotational', var_non_rotational] |
| 71 | + |
| 72 | + unless File.exist?(var_disk1_name) |
| 73 | + vb.customize ['createhd', '--filename', var_disk1_name, '--size', var_disk_size * 1024] |
| 74 | + end |
| 75 | + vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--nonrotational', var_non_rotational, '--medium', var_disk1_name] |
| 76 | + |
| 77 | + unless File.exist?(var_disk2_name) |
| 78 | + vb.customize ['createhd', '--filename', var_disk2_name, '--size', var_disk_size * 1024] |
| 79 | + end |
| 80 | + vb.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 2, '--device', 0, '--type', 'hdd', '--nonrotational', var_non_rotational, '--medium', var_disk2_name] |
| 81 | + end |
| 82 | + |
| 83 | + # Enable provisioning with a shell script. Additional provisioners such as |
| 84 | + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the |
| 85 | + # documentation for more information about their specific syntax and use. |
| 86 | + config.vm.provision "shell", inline: <<-SHELL |
| 87 | + sh /vagrant/scripts/setup.sh |
| 88 | + SHELL |
| 89 | +end |
0 commit comments