2023-06-05 23:42:26 +03:00
|
|
|
|
2023-06-06 00:30:05 +03:00
|
|
|
$ENALBE_SYNC_FOLDER = false
|
|
|
|
$HOST_NET = "204-net"
|
|
|
|
|
|
|
|
$PROVISION_SSH_KEY_SCRIPT=<<EOF
|
|
|
|
mkdir -p /root/.ssh
|
|
|
|
chmod 0700 /root/.ssh
|
|
|
|
cat /home/vagrant/.ssh/vagrant.pub >> /root/.ssh/authorized_keys
|
|
|
|
chmod 0600 /root/.ssh/authorized_keys
|
|
|
|
chown root:root -R /root/.ssh
|
|
|
|
mkdir -p /home/vagrant/.ssh
|
|
|
|
chmod 0700 /home/vagrant/.ssh
|
|
|
|
echo /home/vagrant/.ssh/vagrant.pub >> /home/vagrant/.ssh/authorized_keys
|
|
|
|
chmod 0600 /home/vagrant/.ssh/authorized_keys
|
|
|
|
chown vagrant:vagrant -R /home/vagrant/.ssh
|
|
|
|
EOF
|
|
|
|
|
2023-06-05 23:42:26 +03:00
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "almalinux/8"
|
2023-06-06 00:30:05 +03:00
|
|
|
|
|
|
|
# config.ssh.forward_agent = false
|
|
|
|
# config.ssh.insert_key = true
|
|
|
|
# config.ssh.insert_key = false
|
|
|
|
|
|
|
|
# config.ssh.username = "vagrant"
|
|
|
|
# config.ssh.password = "vagrant"
|
|
|
|
# config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
|
2023-06-05 23:42:26 +03:00
|
|
|
# config.ssh.private_key_path = "~/.ssh/id_rsa"
|
2023-06-06 00:30:05 +03:00
|
|
|
# config.ssh.private_key_path = ['~/.ssh/vagrant' ]
|
|
|
|
config.ssh.private_key_path = ['~/.ssh/vagrant', '~/.vagrant.d/insecure_private_key' ]
|
|
|
|
|
|
|
|
|
2023-06-05 23:42:26 +03:00
|
|
|
|
|
|
|
config.vm.provider "hyperv" do |hv, override|
|
|
|
|
hv.vmname = "almalinux8"
|
|
|
|
hv.memory = 2048
|
2023-06-06 00:30:05 +03:00
|
|
|
hv.cpus = 6
|
2023-06-05 23:42:26 +03:00
|
|
|
override.vm.allowed_synced_folder_types = [:rsync]
|
|
|
|
end
|
|
|
|
|
2023-06-06 00:30:05 +03:00
|
|
|
config.vm.network "public_network", bridge: $HOST_NET
|
|
|
|
|
2023-06-05 23:42:26 +03:00
|
|
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
2023-06-06 00:30:05 +03:00
|
|
|
|
|
|
|
if $ENALBE_SYNC_FOLDER == true
|
2023-06-05 23:42:26 +03:00
|
|
|
config.vm.synced_folder "shared/", "/vagrant", type: "rsync"
|
2023-06-06 00:30:05 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
config.vm.provision "file", source: "~/.ssh/vagrant.pub", destination: "/home/vagrant/.ssh/vagrant.pub"
|
|
|
|
config.vm.provision 'shell', inline: $PROVISION_SSH_KEY_SCRIPT
|
2023-06-05 23:42:26 +03:00
|
|
|
|
|
|
|
end
|