bertvv / ansible-skeleton

An opinionated skeleton for Ansible projects with a development environment powered by Vagrant.
MIT License
100 stars 32 forks source link

ArgumentError for network options #21

Open thomasaelbrecht opened 11 months ago

thomasaelbrecht commented 11 months ago

When running vagrant up, we get an ArgumentError about the network configuration:

$ vagrant up
/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/kernel_v2/config/vm.rb:319:in `network': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from /home/thomas/source/infra-auto/infra-2223-thomasaelbrecht/vmlab/Vagrantfile:151:in `block (3 levels) in <top (required)>'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/v2/loader.rb:37:in `load'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/loader.rb:126:in `block (2 levels) in load'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/loader.rb:119:in `each'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/loader.rb:119:in `block in load'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/loader.rb:116:in `each'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/config/loader.rb:116:in `load'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrantfile.rb:174:in `machine_config'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:983:in `block in find_configured_plugins'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:981:in `each'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:981:in `find_configured_plugins'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:1008:in `process_configured_plugins'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/environment.rb:189:in `initialize'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant:211:in `new'
        from /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant:211:in `<main>'

The solution for this is changing this line:

https://github.com/bertvv/ansible-skeleton/blob/ce41982e8b78560c16fb6e0487e3cb657cdb1ef3/Vagrantfile#L143

into:

node.vm.network :private_network, **network_options(host)