加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Vagrantfile 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
buxiaomo 提交于 2022-08-17 21:34 . fix some bug
# -*- mode: ruby -*-
# vi: set ft=ruby :
# https://app.vagrantup.com/ubuntu/boxes/focal64
VAGRANTFILE_API_VERSION = "2"
cluster = {
"master01" => { :ip => "192.168.56.11", :cpus => 4, :mem => 4096 },
"worker01" => { :ip => "192.168.56.12", :cpus => 4, :mem => 4096 },
"worker02" => { :ip => "192.168.56.13", :cpus => 4, :mem => 4096 },
}
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
cluster.each_with_index do |(hostname, info), index|
config.vm.define hostname do |cfg|
cfg.vm.provider :virtualbox do |vb, override|
config.vm.box = "ubuntu/focal64"
config.vm.box_version = "20220715.0.0"
override.vm.network :private_network, ip: "#{info[:ip]}"
override.vm.hostname = hostname
vb.name = hostname
vb.customize ["modifyvm", :id, "--memory", info[:mem], "--cpus", info[:cpus], "--hwvirtex", "on"]
end # end provider
cfg.vm.provision "shell", inline: <<-SHELL
set -x
sudo mkdir -p /root/.ssh
sudo cp /vagrant/.ssh/id_rsa /root/.ssh/id_rsa
sudo cp /vagrant/.ssh/id_rsa.pub /root/.ssh/id_rsa.pub
sudo cp /vagrant/.ssh/id_rsa.pub /root/.ssh/authorized_keys
sudo chown -R root:root /root/.ssh
sudo apt-get update
sudo apt-get install python3 python3-pip sshpass curl rsync wget vim -y
sudo pip3 install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip
SHELL
end
end
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化