2022-11-25 13:07:09 +00:00
|
|
|
Vagrant.require_version ">= 2.0.0"
|
|
|
|
PORT = 19022
|
|
|
|
|
|
|
|
def provisioned?(vm="default", provider="virtualbox")
|
|
|
|
File.exist?(".vagrant/machines/#{vm}/#{provider}/action_provision")
|
|
|
|
end
|
2018-06-23 23:44:30 +00:00
|
|
|
|
|
|
|
Vagrant.configure(2) do |config|
|
2022-11-25 13:07:09 +00:00
|
|
|
config.vm.network :private_network, ip: "192.168.56.10"
|
|
|
|
config.vm.network :forwarded_port, guest: PORT, host: PORT
|
2018-06-23 23:44:30 +00:00
|
|
|
|
2022-11-25 13:07:09 +00:00
|
|
|
config.vm.box = "ubuntu/focal64"
|
|
|
|
config.vm.hostname = "datacoop"
|
|
|
|
|
|
|
|
config.vm.provider :virtualbox do |v|
|
2023-10-04 17:59:09 +00:00
|
|
|
v.cpus = 8
|
|
|
|
v.memory = 16384
|
2022-11-25 13:07:09 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
config.vm.provision :ansible do |ansible|
|
|
|
|
ansible.compatibility_mode = "2.0"
|
|
|
|
ansible.playbook = "playbook.yml"
|
|
|
|
ansible.ask_vault_pass = true
|
|
|
|
ansible.verbose = "v"
|
|
|
|
|
|
|
|
# If the VM is already provisioned, we need to use the new port
|
|
|
|
if provisioned?
|
|
|
|
config.ssh.guest_port = PORT
|
|
|
|
ansible.extra_vars = {
|
2023-10-04 16:42:56 +00:00
|
|
|
ansible_port: PORT,
|
|
|
|
from_vagrant: true
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ansible.extra_vars = {
|
|
|
|
from_vagrant: true
|
2018-06-23 23:44:30 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|