add vagrantfile

This commit is contained in:
zhanglikun 2023-05-18 14:32:16 +08:00
parent 87bb966505
commit 1b4ef4b377
No known key found for this signature in database
GPG Key ID: CEA7CACC468ACDFE
2 changed files with 36 additions and 1 deletions

View File

@ -10,4 +10,5 @@ sed -e "s/10.0.0.11/${master1}/g" \
-e "s/10.0.0.13/${master3}/g" \
-e "s/10.0.0.3/${vip}/g" \
-i keepalived/*.conf \
-i 2-create_k8s.sh
-i 2-create_k8s.sh \
-i Vagrantfile

34
Vagrantfile vendored Normal file
View File

@ -0,0 +1,34 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
servers = {
:master1 => '10.0.0.11',
:master2 => '10.0.0.12',
:master3 => '10.0.0.13'
}
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.box_check_update = false
# 自动插入hosts
# vagrant plugin install vagrant-hostmanager
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
servers.each do |server_name, server_ip|
config.vm.define server_name do |server_config|
server_config.vm.hostname = "#{server_name.to_s}"
server_config.vm.network :private_network, ip: server_ip
server_config.vm.provider "virtualbox" do |vb|
vb.name = server_name.to_s
vb.memory = "2048"
vb.cpus = 4
end
end
end
end