Vagrant:不应存在以下设置:ssh

问题描述 投票:0回答:1

您好,感谢您花时间与我一起研究这个问题。我最近转换到一个新的工作站,发现我的Vagrantfile无法正常工作。如果重要,工作站是新的,但操作系统(RHEL 7.4)保持不变。相同版本的Vagrant(2.0.1)和VirtualBox(5.2)

我在执行vagrant up时收到的错误:

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The following settings shouldn't exist: ssh

下面是Vagrant文​​件,值得一提的是,如果我注释掉字符串aggregation01.vm.ssh.insert_key = false,我可以成功启动第一个设备(aggregation01),但是这个解决方法在应用于我的其他框时不一致。

由于简洁,仅显示Vagrantfile的前80行,可以在Vagrantfile查看完整文件

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

# Spine-Leaf Architecture in a Multi-vendor Campus Access layer
#
#
#                           +---------------+         +---------------+
#                           | aggregation01 |         | aggregation02 |
#                           +---------------+         +---------------+
#                              |              \     /            |
#                              |                \ /              |
#                              |                / \              |
#                              |              /     \            |
#                           +---------------+         +---------------+
#                           |    spine01    |         |    spine02    |
#                           +---------------+         +---------------+
#                           /  |      \       \      /        /  |  \
#                       /      |         \      / \       /      |     \
#                   /          |          / \         /\         |        \
#               /              |     /         \  /         \    |           \
#           /                  |/            /     \            \|              \
#       /                  /   |         /            \          |   \             \
#   /                 /        |     /                   \       |         \          \
#   +--------------+        +---------------+         +---------------+        +--------------+
#   |    leaf01    |        |    leaf02     |         |    leaf03     |        |    leaf04    |
#   +--------------+        +---------------+         +---------------+        +--------------+

arista = 'arista_vEOS_4_20'
junos_pfe = 'juniper/vqfx10k-pfe'
junos = 'juniper/vqfx10k-re'
cumulus = 'CumulusCommunity/cumulus-vx'

Vagrant.configure(2) do |config|

  # ######################################
  # ###   Define namespace for boxes   ###
  # ######################################
  # sp1 = "spine01"
  # sp2 = "spine02"
  # agg1 = "aggregation01"
  # agg2 = "aggregation02"
  # leaf01 = "leaf01"
  # leaf01_pfe = "leaf01_pfe"
  # leaf02 = "leaf02"
  # leaf02_pfe = "leaf02_pfe"
  # leaf03 = "leaf03"
  # leaf03_pfe = "leaf03_pfe"
  # leaf04 = "leaf04"
  # leaf04_pfe = "leaf04_pfe"
  wbid = ENV['USER']
  offset = 0

  # ######################################
  # ###    aggregation01 - build vm    ###
  # ######################################
  config.vm.define "aggregation01" do |aggregation01|
    aggregation01.vm.ssh.insert_key = false
    aggregation01.vm.hostname = "aggregation01"
    aggregation01.vm.box = cumulus
    aggregation01.vm.box_version = "3.5.0"
    aggregation01.vm.provider "virtualbox" do |v|
      v.name = "#{wbid}_aggregation01"
      v.customize ["modifyvm", :id, '--audiocontroller', 'AC97', '--audio', 'Null']
      v.memory = 768
    end
    #   see note here: https://github.com/pradels/vagrant-libvirt#synced-folders
    aggregation01.vm.synced_folder ".", "/vagrant", disabled: true
    # NETWORK INTERFACES
    # link for swp1 --> spine01
    aggregation01.vm.network "private_network", virtualbox__intnet: "aggregation01_spine01", auto_config: false , :mac => "a00000000161"
    # link for swp2 --> spine02
aggregation01.vm.network "private_network", virtualbox__intnet: "aggregation01_spine02", auto_config: false , :mac => "443839000143"
    # link for swp3 --> tbd
aggregation01.vm.network "private_network", virtualbox__intnet: "aggregation01_aggregation02", auto_config: false , :mac => "44383900014c"
    aggregation01.vm.provider "virtualbox" do |vbox|
      vbox.customize ['modifyvm', :id, '--nicpromisc2', 'allow-all']
      vbox.customize ['modifyvm', :id, '--nicpromisc3', 'allow-all']
      vbox.customize ['modifyvm', :id, '--nicpromisc4', 'allow-all']
      vbox.customize ["modifyvm", :id, "--nictype1", "virtio"]
    end
    # Fixes "stdin: is not a tty" and "mesg: ttyname failed : Inappropriate ioctl for device"  messages --> https://github.com/mitchellh/vagrant/issues/1673
    aggregation01.vm.provision :shell , inline: "(sudo grep -q 'mesg n' /root/.profile 2>/dev/null && sudo sed -i '/mesg n/d' /root/.profile  2>/dev/null) || true;", privileged: false
      end
ssh vagrant virtual-machine virtualbox vagrantfile
1个回答
0
投票

我想简单地从行中删除.vm可能会删除错误,这样就可以了

aggregation01.vm.ssh.insert_key = false

应该

aggregation01.ssh.insert_key = false

对于其他VM也是如此。但看起来你可能已经在git存储库中解决了这个问题,因为ssh行在那里有所不同?

我尝试根据存储库中的vagrantfile重新创建前两个VM,并设法无误地执行此操作但是当我重新输入行中的.vm时,我得到了相同的错误。

© www.soinside.com 2019 - 2024. All rights reserved.