Skip to content

Instantly share code, notes, and snippets.

@lukassup
Last active July 11, 2017 15:47
Show Gist options
  • Select an option

  • Save lukassup/927fe677586414b392e4fa45b48d959c to your computer and use it in GitHub Desktop.

Select an option

Save lukassup/927fe677586414b392e4fa45b48d959c to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
CPU = 1
MEM = 512
DOMAIN = 'cluster'
NET_BRIDGE = 'virbr0'
# NOTE: required for VBox linked_clone
Vagrant.require_version '>= 1.8', '<2.0'
Vagrant.configure('2') do |config|
# NOTE: VirtualBox is useless for Fedora Atomic Host since it does not come
# with VBox additions. You can't set the hostname, use shared folders, etc.
config.vm.box = 'fedora/25-atomic-host'
# Virtualbox specific configuration
config.vm.provider 'virtualbox' do |vb|
vb.gui = false
vb.cpus = CPU
vb.memory = MEM
vb.linked_clone = true
end
# libvirt specific configuration
config.vm.provider :libvirt do |domain|
domain.graphics_type = 'none'
domain.graphics_ip = nil
domain.graphics_port = nil
domain.video_type = nil
domain.video_vram = 0
domain.cpus = CPU
domain.memory = MEM
domain.random model: 'random'
end
# / is not writable on atomic host
config.vm.synced_folder '.', '/vagrant', disabled: true
# VirtualBox Fedora Atomic Host does not have VBox guest additions so must
# use rsync here
config.vm.synced_folder '.', '/var/vagrant', type: 'rsync', readonly: true
# use 9p shared dir for libvirt
config.vm.provider :libvirt do |_, override|
override.vm.synced_folder '.', '/var/vagrant', type: '9p', readonly: true
end
config.vm.network :public_network,
bridge: NET_BRIDGE,
dev: NET_BRIDGE,
mode: 'bridge',
type: 'bridge',
network_name: 'cluster-network'
%w(master1 master2 master3 node1 node2 node3).each do |vm_name|
config.vm.define vm_name do |machine|
machine.vm.hostname = "#{vm_name}.#{DOMAIN}"
end
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment