这是我的 vagrantfile
PROJECT_NAME = "petalandstem"
BACKEND_DIR = "/home/vagrant/#{PROJECT_NAME}/src/backend"
FRONTEND_DIR = "/home/vagrant/#{PROJECT_NAME}/src/frontend"
Vagrant.require_version ">= 1.8.1"
Vagrant.configure(2) do |config|
config.vm.hostname = PROJECT_NAME
config.vm.box = "ubuntu/xenial64"
config.vm.network :private_network, ip: "192.168.0.23"
config.ssh.forward_agent = true
config.ssh.port = "22"
config.ssh.host = '192.168.22.22'
config.vm.synced_folder "./backend", BACKEND_DIR
config.vm.synced_folder "./frontend", FRONTEND_DIR
config.vm.network "forwarded_port", guest: 8000, host: 8000, auto_correct: true
# config.vm.network "forwarded_port", guest: 2222, host: 22
config.vm.provider :virtualbox do |vb|
vb.name = PROJECT_NAME
vb.memory = "512"
vb.cpus = 1
vb.gui = false
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/site.yml"
ansible.inventory_path = "ansible/vagrant.ini"
ansible.host_key_checking = false
ansible.limit = "*"
end
end
我通过 ansible 和 vagrant 设置了一个项目,并使用了虚拟盒。我已经正确安装了所有内容。我启动了虚拟盒并进入了 vagrant。但我无法从本地终端 ping 它。有人能帮忙吗?