713fcf7659
To be able to run the example using the container we need to change our hosts LVM configuration, which was not explained in the docs. This patch adds the explanation as well as a simplified way of running this without touching our own host using Vagrant + libvirt + Ansible.
46 lines
1.5 KiB
Ruby
46 lines
1.5 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
MEMORY = 1048
|
|
CPUS = 1
|
|
|
|
Vagrant.configure("2") do |config|
|
|
config.ssh.insert_key = false
|
|
config.vm.box = "centos/7"
|
|
|
|
# Override
|
|
config.vm.provider :libvirt do |v,override|
|
|
override.vm.synced_folder '.', '/home/vagrant/sync', disabled: true
|
|
v.memory = MEMORY
|
|
v.cpus = CPUS
|
|
# Support remote libvirt
|
|
$libvirt_host = ENV.fetch('LIBVIRT_HOST', '')
|
|
$libvirt_user = ENV.fetch('LIBVIRT_USER', 'root')
|
|
v.host = $libvirt_host
|
|
if $libvirt_host.empty? || $libvirt_host.nil?
|
|
v.connect_via_ssh = false
|
|
else
|
|
v.username = $libvirt_user
|
|
v.connect_via_ssh = true
|
|
end
|
|
end
|
|
|
|
# Make kub master
|
|
config.vm.define :master do |master|
|
|
master.vm.provision :ansible do |ansible|
|
|
ansible.limit = "all"
|
|
ansible.playbook = "site.yml"
|
|
ansible.groups = {
|
|
"master_node" => ["master"],
|
|
}
|
|
# Workaround for issue #644 on Vagrant < v1.8.6
|
|
# Replace the ProxyCommand with the command specified by
|
|
# vagrant ssh-config
|
|
req = Gem::Requirement.new('<1.8.6')
|
|
if req.satisfied_by?(Gem::Version.new(Vagrant::VERSION)) and not $libvirt_host.empty?
|
|
ansible.raw_ssh_args = "-o 'ProxyCommand=ssh #{$libvirt_host} -l #{$libvirt_user} -i #{Dir.home}/.ssh/id_rsa nc %h %p'"
|
|
end
|
|
end
|
|
end
|
|
end
|