Make vagrant silently run pxe nodes, without checks
This commit is contained in:
parent
5da5f18760
commit
39170b3b1b
13
Vagrantfile
vendored
13
Vagrantfile
vendored
@ -41,6 +41,9 @@ SLAVES_CPUS = cfg["slaves_cpus"]
|
|||||||
PARAVIRT_PROVIDER = cfg.fetch('paravirtprovider', false)
|
PARAVIRT_PROVIDER = cfg.fetch('paravirtprovider', false)
|
||||||
PREPROVISIONED = cfg.fetch('preprovisioned', true)
|
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=[])
|
def ansible_playbook_command(filename, args=[])
|
||||||
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/bootstrap/playbooks/#{filename} #{args.join ' '}"
|
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/bootstrap/playbooks/#{filename} #{args.join ' '}"
|
||||||
end
|
end
|
||||||
@ -118,10 +121,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
config.vm.provision "shell", inline: slave_celery, privileged: true
|
config.vm.provision "shell", inline: slave_celery, privileged: true
|
||||||
config.vm.network "private_network", ip: "10.0.0.#{ip_index}"
|
config.vm.network "private_network", ip: "10.0.0.#{ip_index}"
|
||||||
else
|
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.vm.network "private_network", adapter: 1, ip: "10.0.0.#{ip_index}"
|
||||||
config.vbguest.no_install = true
|
config.vbguest.no_install = true
|
||||||
config.ssh.username = 'root'
|
config.vbguest.auto_update = false
|
||||||
config.ssh.insert_key = false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.provider :virtualbox do |v|
|
config.vm.provider :virtualbox do |v|
|
||||||
@ -162,6 +170,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def boot_order(virt_config, order)
|
def boot_order(virt_config, order)
|
||||||
# Boot order is specified with special flag:
|
# Boot order is specified with special flag:
|
||||||
# --boot<1-4> none|floppy|dvd|disk|net
|
# --boot<1-4> none|floppy|dvd|disk|net
|
||||||
|
61
bootstrap/vagrant_plugins/noop.rb
Normal file
61
bootstrap/vagrant_plugins/noop.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user