厨房未为Vagrant VM分配IP地址

时间:2019-07-12 21:02:02

标签: vagrant test-kitchen

我一直在尝试让我的kitchen.yml分配一个piblic_network IP地址。但是,似乎只为VM分配了127.0.0.1,并且仅使用了其他SSH端口。这是我的kitchen.yml:

---
driver:
  name: vagrant
  ssh:
    insert_key: false
    forward_agent: true
#    ssh_key: ~/.ssh/id_rsa

provisioner:
  name: ansible_playbook

platforms:
  - name: centos7
    driver_plugin: vagrant
    driver_config:
      box: fedora/29-cloud-base
#      box: centos/7

transport:
  ssh_key: ~/.ssh/id_rsa
  username: <%= ENV['USER'] %>

suites:
  - name: kubemaster01
    network:
      - ['public_network',{bridge: "en0: Wi-Fi (AirPort)", ip: '192.168.1.11'}]

我还尝试了Fadora Vagrant图片,但该图片也无效。

这是我的日志:

-----> Starting Kitchen (v2.2.5)
-----> Creating <kubemaster01-centos7>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'fedora/29-cloud-base'...
==> default: Matching MAC address for NAT networking...
       ==> default: Checking if box 'fedora/29-cloud-base' version '29.20181024.1' is up to date...
       ==> default: Setting the name of the VM: kitchen-ansible-soup-kubemaster01-centos7-7ae93ce8-3733-4413-acdc-fe289138d372
       ==> default: Fixed port collision for 22 => 2222. Now on port 2205.
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 (guest) => 2205 (host) (adapter 1)
       ==> default: Running 'pre-boot' VM customizations...
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 127.0.0.1:2205
           default: SSH username: vagrant
           default: SSH auth method: private key
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
           default: The guest additions on this VM do not match the installed version of
           default: VirtualBox! In most cases this is fine, but in rare cases it can
           default: prevent things such as shared folders from working properly. If you see
           default: shared folder errors, please make sure the guest additions within the
           default: virtual machine match the version of VirtualBox you have installed on
           default: your host and reload your VM.
           default: 
           default: Guest Additions Version: 5.2.0 r68940
           default: VirtualBox Version: 6.0
       ==> default: Setting hostname...
       ==> default: Machine not provisioned because `--no-provision` is specified.
       [SSH] Established
       Vagrant instance <kubemaster01-centos7> created.
       Finished creating <kubemaster01-centos7> (0m36.33s).
-----> Kitchen is finished. (0m36.55s)

编辑 出乎意料的是,如果我在定义IP的端口下面转发一个端口,vagrant实际上会这样做。

预先感谢:)

0 个答案:

没有答案