2022-11-18 22:15:56 +00:00
|
|
|
Vagrant.require_version ">= 2.0.0"
|
2022-11-17 07:53:45 +00:00
|
|
|
PORT = 19022
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
def provisioned?(vm="default", provider="virtualbox")
|
|
|
|
File.exist?(".vagrant/machines/#{vm}/#{provider}/action_provision")
|
|
|
|
end
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
Vagrant.configure(2) do |config|
|
|
|
|
config.vm.network :private_network, ip: "192.168.56.10"
|
|
|
|
config.vm.network :forwarded_port, guest: PORT, host: PORT
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
config.vm.box = "ubuntu/focal64"
|
|
|
|
config.vm.hostname = "datacoop"
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
config.vm.provider :virtualbox do |v|
|
|
|
|
v.memory = 4096
|
|
|
|
end
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
config.vm.provision :ansible do |ansible|
|
|
|
|
ansible.compatibility_mode = "2.0"
|
|
|
|
ansible.playbook = "playbook.yml"
|
|
|
|
ansible.ask_vault_pass = true
|
|
|
|
ansible.verbose = "v"
|
|
|
|
ansible.extra_vars = {
|
|
|
|
base_domain: "datacoop.devel"
|
|
|
|
}
|
2022-11-17 21:11:32 +00:00
|
|
|
|
2022-11-18 22:15:56 +00:00
|
|
|
# If the VM is already provisioned, we need to use the new port
|
|
|
|
if provisioned?
|
|
|
|
config.ssh.guest_port = PORT
|
|
|
|
ansible.extra_vars = {
|
|
|
|
ansible_port: PORT
|
|
|
|
}
|
2018-06-23 23:44:30 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|