1 # Copyright 2020 Telefónica Investigación y Desarrollo S.A.U.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 # All Vagrant configuration is done below. The "2" in Vagrant.configure
19 # configures the configuration version (we support older styles for
20 # backwards compatibility). Please don't change it unless you know what
22 Vagrant.configure("2") do |config|
23 # The most common configuration options are documented and commented below.
24 # For a complete reference, please see the online documentation at
25 # https://docs.vagrantup.com.
27 # Every Vagrant development environment requires a box. You can search for
28 # boxes at https://vagrantcloud.com/search.
29 config.vm.box = "ubuntu/bionic64"
31 # Disable automatic box update checking. If you disable this, then
32 # boxes will only be checked for updates when the user runs
33 # `vagrant box outdated`. This is not recommended.
34 # config.vm.box_check_update = false
36 # Create a forwarded port mapping which allows access to a specific port
37 # within the machine from a port on the host machine. In the example below,
38 # accessing "localhost:8080" will access port 80 on the guest machine.
39 # NOTE: This will enable public access to the opened port
40 # config.vm.network "forwarded_port", guest: 80, host: 8080
42 # Create a forwarded port mapping which allows access to a specific port
43 # within the machine from a port on the host machine and only allow access
44 # via 127.0.0.1 to disable public access
45 # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
47 # Create a private network, which allows host-only access to the machine
48 # using a specific IP.
49 # config.vm.network "private_network", ip: "192.168.33.10"
51 # Create a public network, which generally matched to bridged network.
52 # Bridged networks make the machine appear as another physical device on
54 # config.vm.network "public_network"
56 # Share an additional folder to the guest VM. The first argument is
57 # the path on the host to the actual folder. The second argument is
58 # the path on the guest to mount the folder. And the optional third
59 # argument is a set of non-required options.
60 # config.vm.synced_folder "../data", "/vagrant_data"
62 # Provider-specific configuration so you can fine-tune various
63 # backing providers for Vagrant. These expose provider-specific options.
64 # Example for VirtualBox:
66 # config.vm.provider "virtualbox" do |vb|
67 # # Display the VirtualBox GUI when booting the machine
70 # # Customize the amount of memory on the VM:
74 # View the documentation for the provider you are using for more
75 # information on available options.
77 # Enable provisioning with a shell script. Additional provisioners such as
78 # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
79 # documentation for more information about their specific syntax and use.
80 # config.vm.provision "shell", inline: <<-SHELL
82 # apt-get install -y apache2
85 # Feeds some configuration from the host to `vagrant` user in VM:
88 # - Public key in `authorized_keys`
90 #--------------------------------------------------------------
91 config.vm.provision "shell", privileged: false, inline: <<-SHELL
92 echo -e '#{File.read("#{Dir.home}/.ssh/id_rsa")}' > '/home/vagrant/.ssh/id_rsa'
93 echo -e '#{File.read("#{Dir.home}/.ssh/id_rsa.pub")}' > '/home/vagrant/.ssh/id_rsa.pub'
94 echo -e '#{File.read("#{Dir.home}/.ssh/id_rsa.pub")}' >> '/home/vagrant/.ssh/authorized_keys'
95 echo -e '#{File.read("#{Dir.home}/.gitconfig")}' > '/home/vagrant/.gitconfig'
96 chmod 600 /home/vagrant/.ssh/id_rsa /home/vagrant/.ssh/id_rsa.pub /home/vagrant/.gitconfig
99 # Feeds config files for setting up Robot tests and local environment into the VM
100 config.vm.provision "shell", privileged: false, inline: <<-SHELL
101 sudo apt-get update -y
102 sudo apt-get install dos2unix
103 cp -r /vagrant/baseconfig /home/vagrant/
104 cp -r /vagrant/localconfig /home/vagrant/
105 dos2unix /home/vagrant/baseconfig/*.rc
106 dos2unix /home/vagrant/localconfig/*.rc
107 dos2unix /home/vagrant/localconfig/*.sh
110 # Performs the provision of the Vagrant Sandbox for Robot tests
111 config.vm.provision :shell, privileged: false, path: "provisioner.sh"