|
| 1 | +# -*- mode: ruby -*- |
| 2 | +# vi: set ft=ruby : |
| 3 | + |
| 4 | +# Check for missing plugins |
| 5 | +required_plugins = %w( vagrant-vbguest ) |
| 6 | +plugin_installed = false |
| 7 | +required_plugins.each do |plugin| |
| 8 | + unless Vagrant.has_plugin?(plugin) |
| 9 | + system "vagrant plugin install #{plugin}" |
| 10 | + plugin_installed = true |
| 11 | + end |
| 12 | +end |
| 13 | + |
| 14 | +# If new plugins installed, restart Vagrant process |
| 15 | +if plugin_installed === true |
| 16 | + exec "vagrant #{ARGV.join' '}" |
| 17 | +end |
| 18 | + |
| 19 | +# All Vagrant configuration is done below. The "2" in Vagrant.configure |
| 20 | +# configures the configuration version (we support older styles for |
| 21 | +# backwards compatibility). Please don't change it unless you know what |
| 22 | +# you're doing. |
| 23 | +Vagrant.configure("2") do |config| |
| 24 | + # The most common configuration options are documented and commented below. |
| 25 | + # For a complete reference, please see the online documentation at |
| 26 | + # https://docs.vagrantup.com. |
| 27 | + |
| 28 | + # Every Vagrant development environment requires a box. You can search for |
| 29 | + # boxes at https://atlas.hashicorp.com/search. |
| 30 | + config.vm.box = "fedora/25-cloud-base" |
| 31 | + |
| 32 | + # Disable automatic box update checking. If you disable this, then |
| 33 | + # boxes will only be checked for updates when the user runs |
| 34 | + # `vagrant box outdated`. This is not recommended. |
| 35 | + # config.vm.box_check_update = false |
| 36 | + |
| 37 | + # Create a forwarded port mapping which allows access to a specific port |
| 38 | + # within the machine from a port on the host machine. In the example below, |
| 39 | + # accessing "localhost:8080" will access port 80 on the guest machine. |
| 40 | + # NOTE: This will enable public access to the opened port |
| 41 | + # config.vm.network "forwarded_port", guest: 80, host: 8080 |
| 42 | + |
| 43 | + # Create a forwarded port mapping which allows access to a specific port |
| 44 | + # within the machine from a port on the host machine and only allow access |
| 45 | + # via 127.0.0.1 to disable public access |
| 46 | + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" |
| 47 | + |
| 48 | + # Create a private network, which allows host-only access to the machine |
| 49 | + # using a specific IP. |
| 50 | + # config.vm.network "private_network", ip: "192.168.33.10" |
| 51 | + |
| 52 | + # Create a public network, which generally matched to bridged network. |
| 53 | + # Bridged networks make the machine appear as another physical device on |
| 54 | + # your network. |
| 55 | + # config.vm.network "public_network" |
| 56 | + |
| 57 | + # we will try to autodetect this path. |
| 58 | + # However, if we cannot or you have a special one you may pass it like: |
| 59 | + # config.vbguest.iso_path = "#{ENV['HOME']}/Downloads/VBoxGuestAdditions.iso" |
| 60 | + # or an URL: |
| 61 | + # config.vbguest.iso_path = "http://company.server/VirtualBox/%{version}/VBoxGuestAdditions.iso" |
| 62 | + # or relative to the Vagrantfile: |
| 63 | + # config.vbguest.iso_path = File.expand_path("../relative/path/to/VBoxGuestAdditions.iso", __FILE__) |
| 64 | + |
| 65 | + # set auto_update to false, if you do NOT want to check the correct |
| 66 | + # additions version when booting this machine |
| 67 | + config.vbguest.auto_update = true |
| 68 | + |
| 69 | + # do NOT download the iso file from a webserver |
| 70 | + config.vbguest.no_remote = true |
| 71 | + |
| 72 | + # Share an additional folder to the guest VM. The first argument is |
| 73 | + # the path on the host to the actual folder. The second argument is |
| 74 | + # the path on the guest to mount the folder. And the optional third |
| 75 | + # argument is a set of non-required options. |
| 76 | + # config.vm.synced_folder "../data", "/vagrant_data" |
| 77 | + config.vm.synced_folder ".", "/vagrant", type: "virtualbox" |
| 78 | + |
| 79 | + # Provider-specific configuration so you can fine-tune various |
| 80 | + # backing providers for Vagrant. These expose provider-specific options. |
| 81 | + # Example for VirtualBox: |
| 82 | + # |
| 83 | + config.vm.provider "virtualbox" do |vb| |
| 84 | + # # Display the VirtualBox GUI when booting the machine |
| 85 | + # vb.gui = true |
| 86 | + # |
| 87 | + # # Customize the amount of memory on the VM: |
| 88 | + vb.memory = "1024" |
| 89 | + end |
| 90 | + # |
| 91 | + # View the documentation for the provider you are using for more |
| 92 | + # information on available options. |
| 93 | + |
| 94 | + # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies |
| 95 | + # such as FTP and Heroku are also available. See the documentation at |
| 96 | + # https://docs.vagrantup.com/v2/push/atlas.html for more information. |
| 97 | + # config.push.define "atlas" do |push| |
| 98 | + # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" |
| 99 | + # end |
| 100 | + |
| 101 | + # Enable provisioning with a shell script. Additional provisioners such as |
| 102 | + # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the |
| 103 | + # documentation for more information about their specific syntax and use. |
| 104 | + # config.vm.provision "shell", inline: <<-SHELL |
| 105 | + # apt-get update |
| 106 | + # apt-get install -y apache2 |
| 107 | + # SHELL |
| 108 | + config.vm.provision "shell", inline: <<-OSPREREQ |
| 109 | + echo "installing os pre reqs:" |
| 110 | + dnf install -y unix2dos dos2unix |
| 111 | + OSPREREQ |
| 112 | + config.vm.provision "shell", inline: <<-SHELL |
| 113 | + echo "installing ruby & prereq for installing gems:" |
| 114 | + dnf install -y ruby ruby-devel redhat-rpm-config zlib-devel patch |
| 115 | + echo "installing ruby gems:" |
| 116 | + gem install bundler |
| 117 | + gem install dockerspec |
| 118 | + echo "installing docker:" |
| 119 | + dnf -y install dnf-plugins-core |
| 120 | + dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo |
| 121 | + dnf makecache fast |
| 122 | + dnf -y install docker-ce |
| 123 | + usermod -aG docker vagrant |
| 124 | + systemctl enable docker |
| 125 | + systemctl start docker |
| 126 | + SHELL |
| 127 | + config.vm.provision "shell", inline: <<-DOCKERRAIC |
| 128 | + echo "installing docker_raic:"A |
| 129 | + if [ ! -f /usr/local/bin/docker_raic ] |
| 130 | + then |
| 131 | + cp /vagrant/bin/docker_raic /usr/local/bin/docker_raic |
| 132 | + chmod 755 /usr/local/bin/docker_raic |
| 133 | + fi |
| 134 | + DOCKERRAIC |
| 135 | +end |
0 commit comments