tobiko/roles/tobiko-compile-python/Vagrantfile

101 lines
3.5 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Customize the count of CPU cores on the VM
CPUS = 4
# Customize the amount of memory on the VM
MEMORY = 512
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
BOX = "generic/centos7"
TOX_INI_DIR = '../..'
TEST_DIR = File.join(File.dirname(__FILE__), 'tests')
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
config.vm.box = BOX
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: DEVSTACK_HOST_IP
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network", ip: "172.18.161.6"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = false
vb.cpus = CPUS
vb.memory = MEMORY
end
config.vm.provider "libvirt" do |libvirt|
libvirt.cpus = CPUS
libvirt.memory = MEMORY
end
# No need to copy tox.ini folder to nodes to execute test cases
config.vm.synced_folder TOX_INI_DIR, "/vagrant", type: "rsync",
rsync__exclude: [".tox/"]
config.vm.provision "ansible" do |ansible|
ansible.playbook = "resolv_conf.yaml"
end
# Spawn a VM for each playbook in TEST_DIR
for playbook_file in Dir[File.join(TEST_DIR, 'test_*.yaml')] do
test_name = File.basename(playbook_file, '.yaml')
config.vm.define test_name do |node|
node.vm.hostname = test_name.gsub('_', '-')
node.vm.provision "ansible" do |ansible|
ansible.playbook = playbook_file
end
end
end
end