hashicorp / vagrant

Vagrant is a tool for building and distributing development environments.
https://www.vagrantup.com
Other
26.25k stars 4.44k forks source link

configure_networks.rb:57:in `[]': no implicit conversion from nil to integer (TypeError) #10963

Closed basictheprogram closed 5 years ago

basictheprogram commented 5 years ago

Vagrant version

$ vagrant -v Vagrant 2.2.5

Host operating system

macOS Mojave 10.14.5

Guest operating system

Ubuntu Bionic

Vagrantfile

config.vm.define "testing_postgres_servers" do |testing_postgres_servers|
    testing_postgres_servers.vm.box = "ubuntu/bionic64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "testing-postgres"   

   testing_postgres_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-postgres"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_ubuntu64/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/postgres_servers.yml"
      ansible.compatibility_mode = "2.0"
    end
  end   # testing_postgres_servers

Debug output

https://gist.github.com/basictheprogram/1b9c5b806d9e6702bfc290e5ad291e0a

Expected behavior

VM is created

Actual behavior

Vagrant crashes with ruby errors

Steps to reproduce

  1. vagrant up testing_postgres_servers

References

Are there any other GitHub issues (open or closed) that should be linked here? For example:

basictheprogram commented 5 years ago

This seems unusual to me. Why is vagrant prepare so many interfaces?

==> testing_postgres_servers: Preparing network interfaces based on configuration...
    testing_postgres_servers: Adapter 1: nat
    testing_postgres_servers: Adapter 2: bridged
    testing_postgres_servers: Adapter 3: bridged
    testing_postgres_servers: Adapter 4: bridged
    testing_postgres_servers: Adapter 5: bridged
    testing_postgres_servers: Adapter 6: bridged
    testing_postgres_servers: Adapter 7: bridged
    testing_postgres_servers: Adapter 8: bridged
    testing_postgres_servers: Adapter 9: bridged
    testing_postgres_servers: Adapter 10: bridged
    testing_postgres_servers: Adapter 11: bridged
    testing_postgres_servers: Adapter 12: bridged
    testing_postgres_servers: Adapter 13: bridged
    testing_postgres_servers: Adapter 14: hostonly
    testing_postgres_servers: Adapter 15: bridged
    testing_postgres_servers: Adapter 16: bridged
    testing_postgres_servers: Adapter 17: bridged
    testing_postgres_servers: Adapter 18: bridged
    testing_postgres_servers: Adapter 19: bridged
    testing_postgres_servers: Adapter 20: bridged
    testing_postgres_servers: Adapter 21: bridged
    testing_postgres_servers: Adapter 22: bridged
    testing_postgres_servers: Adapter 23: bridged
    testing_postgres_servers: Adapter 24: bridged
    testing_postgres_servers: Adapter 25: bridged
    testing_postgres_servers: Adapter 26: bridged
    testing_postgres_servers: Adapter 27: bridged
    testing_postgres_servers: Adapter 28: bridged
    testing_postgres_servers: Adapter 29: hostonly
    testing_postgres_servers: Adapter 30: bridged
    testing_postgres_servers: Adapter 31: bridged
    testing_postgres_servers: Adapter 32: bridged

And in the VirtualBox UI I see this

Oracle_VM_VirtualBox_Manager
briancain commented 5 years ago

Hi @basictheprogram - something tells me that there is more to the Vagrantfile you originally shared! Do you have the full Vagrantfile?

basictheprogram commented 5 years ago

Whole Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|

  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu/trusty64"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "~/data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # 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
  #   sudo apt-get update
  #   sudo apt-get install -y apache2
  # SHELL
  # config.vm.provision "shell", path: "bootstrap.sh"

  config.vm.define "nagios_server" do |nagios_server|
    nagios_server.vm.box = "ubuntu/trusty64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: false

    nagios_server.vm.provider "virtualbox" do |vb|
      vb.name = "nagios_server"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "nagios_server/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      config.ssh.insert_key = false
      ansible.playbook = "../playbooks.git/nagios-server.yml"
      ansible.ask_vault_pass = true
      ansible.tags = "bootstrap,nagios,gnutls-certs"
#      ansible.verbose = "vvvv"
    end
  end   # nagios_server

  config.vm.define "testing_samba_servers" do |testing_samba_servers|
    testing_samba_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: false
    config.vm.hostname = "testing-samba"

    testing_samba_servers.vm.provider "virtualbox" do |vb|
      vb.name = "samba_server"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_samba_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-samba-servers.yml"
#      ansible.tags = "samba-servers"
#      ansible.verbose = "vvvv"
    end
  end   # samba_servers

  # Terraria Server hosted on Ubuntu!
  # 
  # How to run a dedicated Terraria server on Ubuntu 
  # http://redd.it/2a2gjn
  #  
  config.vm.define "terraria_servers" do |terraria_servers|
    terraria_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "terraria-servers"
    config.vm.synced_folder "/Users/tanner/projects/", "/projects"

    terraria_servers.vm.provider "virtualbox" do |vb|
      vb.name = "terraria_servers"
      vb.memory = 2048
      # Huge performance gain here
      vb.linked_clone = true if Vagrant::VERSION >= '1.8.0'
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "terraria_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      #config.ssh.username = "vagrant"
      #config.ssh.forward_agent = true
      #config.ssh.insert_key = true
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/terraria-servers.yml"
      ansible.tags = "bootstrap,terraria-server"
#      ansible.verbose = "vv"
    end
  end   # terraria_server

  config.vm.define "testing_dns_servers" do |testing_dns_servers|
    testing_dns_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: false
    config.vm.hostname = "dns-servers"

    testing_dns_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing_dns_servers"
      vb.memory = 2038
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_dns_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      #config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      #config.ssh.insert_key = false
      ansible.playbook = "../playbooks.git/testing-dns-servers.yml"
      ansible.tags = "dns-servers"
      #ansible.verbose = "vv"
    end
  end   # testing_dns_server

  config.vm.define "testing_dhcpd_servers" do |testing_dhcpd_servers|
    testing_dhcpd_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "testing-dhcpd-servers"   

    testing_dhcpd_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-dhcpd-servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_dhcpd_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/dhcpd-servers.yml"
#      ansible.tags = "dhcpd-servers"
#      ansible.verbose = "vvv"
    end
  end   # dhcpd_server  

  config.vm.define "syslog_servers" do |syslog_servers|
    syslog_servers.vm.box = "ubuntu/trusty64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", ip: "10.0.1.38"

    syslog_servers.vm.provider "virtualbox" do |vb|
      vb.name = "syslog_servers"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      config.ssh.insert_key = false
      ansible.extra_vars = { remote_user: "vagrant" }
      ansible.playbook = "../playbooks.git/syslog-servers.yml"
#      ansible.tags = "bootstrap,syslog-server,gnu-certs"
#      ansible.verbose = "vv"
    end
  end   # syslog_servers  

  config.vm.define "syslog_clients" do |syslog_clients|
    syslog_clients.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "syslog-clients"

    syslog_clients.vm.provider "virtualbox" do |vb|
      vb.name = "syslog_clients"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "syslog_clients/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.forward_agent = true
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/syslog-clients.yml"
#      ansible.tags = "syslog-client"
#      ansible.verbose = "vv"
    end
  end   # syslog_clients   

  config.vm.define "testing_precise64" do |testing_precise64|
    testing_precise64.vm.box = "ubuntu/precise64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true

    testing_precise64.vm.provider "virtualbox" do |vb|
      vb.name = "testing_precise64"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      config.ssh.insert_key = false
      ansible.extra_vars = { remote_user: "vagrant" }
      ansible.playbook = "../playbooks.git/testing-ubuntu64.yml"
    end
  end   # testing_precise64 (Ubuntu 12.04)

  config.vm.define "testing_trusty64" do |testing_trusty64|
    testing_trusty64.vm.box = "ubuntu/trusty64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true

    testing_trusty64.vm.provider "virtualbox" do |vb|
      vb.name = "testing_trusty64"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      config.ssh.insert_key = false
      ansible.extra_vars = { remote_user: "vagrant" }
      ansible.playbook = "../playbooks.git/testing-ubuntu64.yml"
      #ansible.tags = ""
      #ansible.verbose = "vvvv"
    end
  end   # testing_trusty64 (Ubuntu 14.04)

  config.vm.define "testing_xenial64" do |testing_xenial64|
    testing_xenial64.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "ubuntu-xenial64"

    testing_xenial64.vm.provider "virtualbox" do |vb|
      vb.name = "ubuntu_xenial64"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_xenial64/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-ubuntu64.yml"
      ansible.tags = "backuppc"
#      ansible.verbose = "vvvv"
    end
  end   # testing_xenial64 (Ubuntu 16.04)

  config.vm.define "testing_openSUSE" do |testing_openSUSE|
    testing_openSUSE.vm.box = "opensuse/openSUSE-42.1-x86_64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: false
    config.vm.network "private_network",  type: "dhcp"
#    config.vm.synced_folder ".cd IGI", "/vagrant", disabled: true

    testing_openSUSE.vm.provider "virtualbox" do |vb|
      vb.name = "testing_openSUSE"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_openSUSE/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      config.ssh.insert_key = false
      ansible.extra_vars = { remote_user: "vagrant" }
      ansible.playbook = "../playbooks.git/testing_openSUSE.yml"
      ansible.ask_vault_pass = true
#      ansible.tags = "bootstrap,grub2,network-interface,ntp-clients,samba-servers"
#      ansible.verbose = "vvv"
    end
  end   # testing_openSUSE

  config.vm.define "oi_crashplan" do |oi_crashplan|
    oi_crashplan.vm.box = "oi/server64"
#    config.vm.network "private_network", ip: "192.168.50.5"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true

    oi_crashplan.vm.provider "virtualbox" do |vb|
      vb.name = "oi_crashplan"
      vb.memory = 1024
    end

#    config.vm.provision "bootstrap", type: "shell" do |s| 
#      s.path = "testing_servers/bootstrap.sh"
#    end

#    config.vm.provision "ansible", type: "ansible" do |ansible|
#      config.ssh.username = "vagrant"
#      config.ssh.forward_agent = true
#      config.ssh.insert_key = false
#      ansible.extra_vars = { remote_user: "vagrant" }
#      ansible.playbook = "../playbooks.git/syslog-clients.yml"
      #ansible.verbose = "vvvv"
#    end
  end   # oi_crashplan   

  config.vm.define "minecraft_servers" do |minecraft_servers|
    minecraft_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "minecraft-servers"

    minecraft_servers.vm.provider "virtualbox" do |vb|
      vb.name = "minecraft_servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "minecraft_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      #config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
      #config.ssh.insert_key = false
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/minecraft-servers.yml"
      ansible.tags = "minecraft-servers"
      #ansible.verbose = "vv"
    end
  end   # minecraft_server

  config.vm.define "postfix_relay" do |postfix_relay|
    postfix_relay.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "postfix-relay"

    postfix_relay.vm.provider "virtualbox" do |vb|
      vb.name = "postfix_relay"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "postfix_relay/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/postfix-relay.yml"
#      ansible.tags = "postfix-relay,bootstrap"
#      ansible.verbose = "vv"
    end
  end   # postfix_relay

 config.vm.define "convert_servers" do |convert_servers|
    convert_servers.vm.box = "opensuse/openSUSE-42.1-x86_64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "convert-servers"

    convert_servers.vm.provider "virtualbox" do |vb|
      vb.name = "convert_servers"
      vb.memory = 1024
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "convert_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
#      config.ssh.username = "vagrant"
      config.ssh.forward_agent = true
#      config.ssh.insert_key = true
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/convert-servers.yml"
#      ansible.tags = "bootstrap,zypper,grub2,virtual-servers,postfix-satelite,logrotate,apitcron,listchanges,users,backuppc"
#      ansible.verbose = "vvvv"
    end
  end   # convert_servers

  config.vm.define "testing_zesty" do |testing_zesty|
    testing_zesty.vm.box = "ubuntu/zesty64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "testing-zesty"

    testing_zesty.vm.provider "virtualbox" do |vb|
      vb.name = "testing_zesty"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_zesty/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/testing-zesty.yml"
#      ansible.tags = "rancid-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_zesty

  config.vm.define "testing_rancid" do |testing_rancid|
    testing_rancid.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: "en0: Wi-Fi (AirPort)", auto_config: true
    config.vm.hostname = "testing-rancid"

    testing_rancid.vm.provider "virtualbox" do |vb|
      vb.name = "testing_rancid"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_rancid/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.extra_vars = { remote_user: "ansible" }
      ansible.playbook = "../playbooks.git/testing-rancid.yml"
#      ansible.tags = "rancid-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_rancid

  config.vm.define "testing_crossfire_meta_servers" do |testing_crossfire_meta_servers|
    testing_crossfire_meta_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "meta-servers"

    testing_crossfire_meta_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-crossfire-meta-servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_crossfire_meta_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-crossfire-meta-servers.yml"
#      ansible.tags = "crossfire-meta-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_crossfire_meta_servers

  config.vm.define "testing_dokuwiki_servers" do |testing_dokuwiki_servers|
    testing_dokuwiki_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ] , auto_config: true
    config.vm.hostname = "dokuwiki-servers"

    testing_dokuwiki_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-dokuwiki-servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_dokuwiki_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/dokuwiki-servers.yml"
      ansible.tags = "dokuwiki-servers,apache2-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_dokuwiki-servers

  config.vm.define "testing_apache2_servers" do |testing_apache2_servers|
    testing_apache2_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "testing-apache2"

    testing_apache2_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-apache2"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_apache2_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      config.ssh.forward_agent = true
      ansible.playbook = "../playbooks.git/apache2-servers.yml"
#      ansible.tags = "apache2-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_apache2-servers

config.vm.define "testing_moinmoin_servers" do |testing_moinmoin_servers|
    testing_moinmoin_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "testing-moinmoin"   

   testing_moinmoin_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-moinmoin"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_moinmoin/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-moinmoin.yml"
#      ansible.tags = "moinmoin-servers"
#      ansible.verbose = "vv"
    end
  end   # testing_moinmoin_servers

config.vm.define "testing_phpbb3_servers" do |testing_phpbb3_servers|
    testing_phpbb3_servers.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "testing-phpbb3-servers"   

   testing_phpbb3_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-phpbb3-servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_phpbb3_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-phpbb3-servers.yml"
      ansible.tags = "users2"
#      ansible.verbose = "vvv"
    end
  end   # testing_phpbb3_servers

config.vm.define "debian_etch" do |debian_etch|
    debian_etch.vm.box = "nexces/debian-etch"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "debian-etch"   

   debian_etch.vm.provider "virtualbox" do |vb|
      vb.name = "debian_etch"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "debian_etch/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/linux.yml"
      ansible.tags = "users"
#      ansible.verbose = "vvv"
    end
  end   # debian_etch

config.vm.define "testing_docker" do |testing_docker|
    testing_docker.vm.box = "ubuntu/xenial64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.hostname = "testing-docker"   

   testing_docker.vm.provider "virtualbox" do |vb|
      vb.name = "testing-docker"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_docker/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-docker.yml"
      ansible.tags = "docker"
#      ansible.verbose = "vvv"
    end
  end   # testing_docker

config.vm.define "testing_backuppc_servers" do |testing_backuppc_servers|
    testing_backuppc_servers.vm.box = "ubuntu/bionic64"
    config.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    config.vm.network "private_network",  type: "dhcp"
    config.vm.hostname = "testing-backuppc-servers"   

   testing_backuppc_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-backuppc-servers"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_backuppc_servers/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-backuppc-servers.yml"
#      ansible.tags = "backuppc-servers"
#      ansible.verbose = "vvv"
      ansible.compatibility_mode = "2.0"
    end
  end   # testing_backuppc_servers

config.vm.define "windows_10" do |windows_10|
    windows_10.vm.box = "windows_10"
    windows_10.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    windows_10.vm.network "private_network",  type: "dhcp"
    windows_10.vm.hostname = "windows10"  
    windows_10.vm.communicator = "winrm" 

    # Admin user name and password
    windows_10.winrm.username = "vagrant"
    windows_10.winrm.password = "vagrant"

    windows_10.vm.guest = "windows"
    windows_10.windows.halt_timeout = 15
    windows_10.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true

    windows_10.vbguest.auto_update = false

    windows_10.vm.provider "virtualbox" do |v, override|
      v.gui = true
      v.customize ["modifyvm", :id, "--memory", 2048]
      v.customize ["modifyvm", :id, "--cpus", 2]
      v.customize ["modifyvm", :id, "--vram", 128]
      v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
      v.customize ["setextradata", "global", "GUI/SuppressMessages", "all"]
    end

#    config.vm.provision "bootstrap", type: "shell" do |s|
#      s.path = "testing_backuppc_servers/bootstrap.sh"
#    end

#    config.vm.provision "ansible", type: "ansible" do |ansible|
#      ansible.playbook = "../playbooks.git/testing-backuppc-servers.yml"
#      ansible.tags = "backuppc-servers"
#      ansible.verbose = "vvv"
#      ansible.compatibility_mode = "2.0"
#    end
  end   # windows_10

  config.vm.define "testing_bionic64" do |testing_bionic64|
    testing_bionic64.vm.box = "ubuntu/bionic64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "ubuntu-bionic64"

    testing_bionic64.vm.provider "virtualbox" do |vb|
      vb.name = "ubuntu-bionic64"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_bionic64/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/testing-ubuntu64.yml"
      ansible.tags = "postgres_servers,bootstrap"
#      ansible.verbose = "vvvv"
    end
  end   # testing_bionic64 (Ubuntu 18.04)

  config.vm.define "testing_wheezy64" do |testing_wheezy64|
    testing_wheezy64.vm.box = "debian/wheezy64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "debian-wheezy64"

    testing_wheezy64.vm.provider "virtualbox" do |vb|
      vb.name = "debian-wheezy64"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s| 
      s.path = "testing_wheezy64/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.compatibility_mode = "2.0"
      ansible.playbook = "../playbooks.git/testing-ubuntu64.yml"
      ansible.tags = "apt,dump"
      # ansible.verbose = "vvvv"
    end
  end   # testing_wheezy64 (Debian 7)

config.vm.define "windows_2016" do |windows_2016|
    windows_2016.vm.box = "BasicTheProgram/windows_2016"
    windows_2016.vm.network "public_network", bridge: [
      "en0: Wi-Fi (AirPort)",
      "en5: Apple USB Ethernet Adapter",
    ], auto_config: true
    windows_2016.vm.network "private_network",  type: "dhcp"
    windows_2016.vm.hostname = "windows2016"  
    windows_2016.vm.communicator = "winrm" 
    windows_2016.vm.synced_folder "/Users/tanner/projects/", "/projects"

    # Admin user name and password
    windows_2016.winrm.username = "vagrant"
    windows_2016.winrm.password = "vagrant"

    windows_2016.vm.guest = "windows"
    windows_2016.windows.halt_timeout = 15
    windows_2016.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct: true

    windows_2016.vbguest.auto_update = false

    windows_2016.vm.provider "virtualbox" do |v, override|
      v.gui = true
      v.customize ["modifyvm", :id, "--memory", 4096]
      v.customize ["modifyvm", :id, "--cpus", 2]
      v.customize ["modifyvm", :id, "--vram", 128]
      v.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
      v.customize ["setextradata", "global", "GUI/SuppressMessages", "all"]
      v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
      v.customize ["modifyvm", :id, "--audio", "none"]
      v.linked_clone = true if Vagrant::VERSION >= '1.8.0'
      v.name = "vagrant_windows_2016"
    end

    config.vm.provision :shell, :path => "windows/PrepareWindows.ps1", privileged: true
    config.vm.provision :shell, :path => "windows/InstallNet4.ps1", privileged: true
    config.vm.provision :shell, :path => "windows/InstallChocolatey.ps1", privileged: true
    config.vm.provision :shell, :path => "windows/NotifyGuiAppsOfEnvironmentChanges.ps1",privileged: true
    config.vm.provision :shell, :path => "windows/InstallToolchain.ps1", privileged: true
    config.vm.provision :shell, :path => "windows/ConfigureRemotingForAnsible.ps1", privileged: true

#    config.vm.provision "ansible", type: "ansible" do |ansible|
#        ansible.playbook = "../playbooks.git/celadon_windows.yml"
#      ansible.tags = "backuppc-servers"
#        ansible.verbose = "vvv"
#        ansible.compatibility_mode = "2.0"
#    end
  end   # windows_2016

config.vm.define "testing_postgres_servers" do |testing_postgres_servers|
    testing_postgres_servers.vm.box = "ubuntu/bionic64"
    config.vm.network "public_network", bridge: [
      "en4: Thunderbolt Ethernet",
      "en0: Wi-Fi (AirPort)", 
      "en5: Apple USB Ethernet Adapter",
      "en8: MiFi USB620L",
    ], auto_config: true
    config.vm.hostname = "testing-postgres"   

   testing_postgres_servers.vm.provider "virtualbox" do |vb|
      vb.name = "testing-postgres"
      vb.memory = 2048
    end

    config.vm.provision "bootstrap", type: "shell" do |s|
      s.path = "testing_ubuntu64/bootstrap.sh"
    end

    config.vm.provision "ansible", type: "ansible" do |ansible|
      ansible.playbook = "../playbooks.git/postgres_servers.yml"
      ansible.compatibility_mode = "2.0"
#      ansible.tags = "postgres-servers"
#      ansible.verbose = "vvv"
    end
  end   # testing_postgres_servers

end
briancain commented 5 years ago

Thanks @basictheprogram .

So the issue here is that you are using the top scope level option config every where inside your various guest blocks. Even though it's technically formatted to be inside your guest definitions, when you use the config option, that applies to all guests inside your Vagrantfile. As a simple example, if you wanted only your postgres guest to have a hostname, you would need to change

config.vm.hostname = "testing-postgres"   

to

testing_postgres_servers.vm.hostname = "testing-postgres"   

When you define a guest and say config.vm.define "guest" do |guestvar|, the guestvar in this case is the variable in charge of managing that guests configuration. This is why you have so many interfaces being configured. There are several places where you define new guest interfaces with the top scope config option. You'll want to update those to be guest specific, since that seems to be the expected behavior you are looking for.

There should be more information here: https://www.vagrantup.com/docs/multi-machine/#defining-multiple-machines

Hope that helps clear things up! If you are still experiencing an issue after fixing all of that up please let us know and we can open a new issue or open this one up again if it makes sense to do so.

basictheprogram commented 5 years ago

I've had that Vagrantfile in the format 2015 and this is the first time Vagrant has complained! Just making note of it here in case someone else comes along this user error.

briancain commented 5 years ago

@basictheprogram - if you still get the configure_networks error after fixing up those config options let me know. Hopefully not. When looking through the debug log it seemed like some options were missing, which could of been a result of all those top scope config options.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.