Class: VagrantPlugins::GuestCoreOS::Cap::ConfigureNetworks
- Inherits:
-
Object
- Object
- VagrantPlugins::GuestCoreOS::Cap::ConfigureNetworks
- Includes:
- Vagrant::Util
- Defined in:
- lib/crane_rails/templates/override-plugin.rb
Class Method Summary collapse
Class Method Details
.configure_networks(machine, networks) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/crane_rails/templates/override-plugin.rb', line 18 def self.configure_networks(machine, networks) machine.communicate.tap do |comm| # Read network interface names interfaces = [] comm.sudo("ifconfig | grep enp0 | cut -f1 -d:") do |_, result| interfaces = result.split("interfaces\n") end # Configure interfaces # FIXME: fix matching of interfaces with IP adresses networks.each do |network| comm.sudo("imagesfconfig #{interfaces[network[:interface].to_i]} #{network[:ip]} netmask #{network[:netmask]}") end end end |