-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
48 lines (42 loc) · 1.52 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Configure the VM provider (in this case, libvirt/KVM)
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm"
libvirt.memory = 1024 # Allocate 1GB of RAM
libvirt.cpus = 1 # Allocate 1 CPU core
end
# Define the database server VM
config.vm.define "db" do |db|
db.vm.box = "generic/ubuntu2004" # Use Ubuntu 20.04 as the base image
db.vm.hostname = "db-server"
db.vm.network "private_network", ip: "192.168.56.10" # Assign a static IP
end
# Define the authentication server VM
config.vm.define "auth" do |auth|
auth.vm.box = "generic/ubuntu2004"
auth.vm.hostname = "auth-server"
auth.vm.network "private_network", ip: "192.168.56.11"
end
# Define the application server VM
config.vm.define "app" do |app|
app.vm.box = "generic/ubuntu2004"
app.vm.hostname = "app-server"
app.vm.network "private_network", ip: "192.168.56.12"
end
# Provision all VMs using Ansible
config.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.groups = {
"db" => ["db"],
"auth" => ["auth"],
"app" => ["app"]
}
# Disable SSH host key checking for easier provisioning
ansible.raw_ssh_args = ['-o UserKnownHostsFile=/dev/null', '-o StrictHostKeyChecking=no']
# Specify the Python interpreter to use
ansible.extra_vars = { ansible_python_interpreter: "/usr/bin/python3" }
end
end