Make vagrant silently run pxe nodes, without checks

This commit is contained in:
Evgeniy L 2015-10-12 19:26:41 +03:00
parent 5da5f18760
commit 39170b3b1b
2 changed files with 72 additions and 2 deletions

13
Vagrantfile vendored
View File

@ -41,6 +41,9 @@ SLAVES_CPUS = cfg["slaves_cpus"]
PARAVIRT_PROVIDER = cfg.fetch('paravirtprovider', false)
PREPROVISIONED = cfg.fetch('preprovisioned', true)
# Initialize noop plugins only in case of PXE boot
require_relative 'bootstrap/vagrant_plugins/noop' unless PREPROVISIONED
def ansible_playbook_command(filename, args=[])
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/bootstrap/playbooks/#{filename} #{args.join ' '}"
end
@ -118,10 +121,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision "shell", inline: slave_celery, privileged: true
config.vm.network "private_network", ip: "10.0.0.#{ip_index}"
else
# Disable attempts to install guest os and check that node is booted using ssh,
# because nodes will have ip addresses from dhcp, and vagrant doesn't know
# which ip to use to perform connection
config.vm.communicator = :noop
config.vm.guest = :noop_guest
# Configure network to boot vm using pxe
config.vm.network "private_network", adapter: 1, ip: "10.0.0.#{ip_index}"
config.vbguest.no_install = true
config.ssh.username = 'root'
config.ssh.insert_key = false
config.vbguest.auto_update = false
end
config.vm.provider :virtualbox do |v|
@ -162,6 +170,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
def boot_order(virt_config, order)
# Boot order is specified with special flag:
# --boot<1-4> none|floppy|dvd|disk|net

View File

@ -0,0 +1,61 @@
# Noop Vagrant plugins are used in case if Vagrant does not
# have an access to VMs (e.g. there is no information about ip),
# so it just runs VMs and does not try to perform additional
# actions using SSH.
class NoopCommunicator < Vagrant.plugin("2", :communicator)
def ready?
true
end
def wait_for_ready(timeout)
true
end
end
class NoopGuest < Vagrant.plugin("2", :guest)
def self.change_host_name(*args)
true
end
def self.configure_networks(*args)
true
end
def self.mount_virtualbox_shared_folder(*args)
true
end
end
class NoopCommunicatorPlugin < Vagrant.plugin("2")
name 'Noop communicator/guest'
description 'Noop communicator/guest'
communicator('noop') do
NoopCommunicator
end
guest 'noop_guest' do
NoopGuest
end
guest_capability 'noop_guest', 'change_host_name' do
NoopGuest
end
guest_capability 'noop_guest', 'configure_networks' do
NoopGuest
end
guest_capability 'noop_guest', 'mount_virtualbox_shared_folder' do
NoopGuest
end
end