ansible/Vagrantfile

31 lines
935 B
Ruby

Vagrant.require_version ">= 1.7.0"
PORT = 19022
Vagrant.configure(2) do |config|
config.vm.network :forwarded_port, guest: PORT, host: PORT, id: "new_ssh"
# If we are trying to SSH into the VM, we need to use the new port
if ARGV[0] == "ssh"
config.ssh.guest_port = PORT
end
config.vm.define "datacoop" do |datacoop|
datacoop.vm.box = "ubuntu/focal64"
datacoop.vm.hostname = "datacoop"
datacoop.vm.provider "virtualbox" do |v|
v.memory = 4096
end
datacoop.vm.provision "ansible" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.ask_vault_pass = true
ansible.verbose = "v"
# If we are running the provision command, then we override the ansible_port
if ARGV[0] == "provision"
ansible.host_vars = {
"datacoop" => {
"ansible_port" => PORT
}
}
end
end
end
end