gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 14:30:44 25 4
gpt4 key购买 nike

您好,感谢您抽出宝贵时间与我一起研究这个问题。我最近过渡到一个新的工作站,发现我的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

以下是Vagrantfile,值得一提的是,如果我注释掉字符串 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

最佳答案

我认为从行中删除.vm可能会消除错误,例如

aggregation01.vm.ssh.insert_key = false

应该
aggregation01.ssh.insert_key = false

对于其他VM同样如此。但看起来您可能已经在git存储库中解决了此问题,因为那里的ssh行不同?

我尝试根据存储库中的vagrantfile重新创建前两个VM,并设法做到了没有错误,但是当我在该行中重新输入 .vm时,却遇到了相同的错误。

关于ssh - Vagrant :以下设置不应存在:ssh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48042844/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com