Vagrant version:
Vagrant 2.2.10
Host OS:
Windows 10 (20045, May 2020)
Guest OS:
Ubuntu 18.04 (tried with 16.04, 20.04)
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "virtualbox" do |vb|
vb.memory = "4024"
vb.cpus = "1"
end
config.vm.provision "ansible" do |ansible|
ansible.become = true
ansible.verbose = "v"
ansible.playbook = "roles/firewall.yml"
ansible.galaxy_roles_path = "./roles"
end
end
Error:
/mnt/c/Users/KeithJames/firewall-role-ak$ vagrant up --provision
Bringing machine 'default' up with 'virtualbox' provider... ==> default:
Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Running provisioner: ansible... default: Running
ansible-playbook... PYTHONUNBUFFERED=1 ANSIBLE_FORCE_COLOR=true
ANSIBLE_ROLES_PATH='/mnt/c/Users/KeithJames/firewall-role-ak/roles'
ANSIBLE_HOST_KEY_CHECKING=false ANSIBLE_SSH_ARGS='-o
UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o
ControlPersist=60s' ansible-playbook --connection=ssh --timeout=30
--limit="default"
--inventory-file=/mnt/c/Users/KeithJames/firewall-role-ak/.vagrant/provisioners/ansible/inventory
--become -v roles/firewall.yml Using /etc/ansible/ansible.cfg as config
file PLAY [all]
********************************************************************* TASK
[Gathering Facts] *********************************************************
fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Failed to
connect to the host via ssh: ssh: connect to host 127.0.0.1 port 2222:
Connection refused", "unreachable": true} PLAY RECAP
*********************************************************************
default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0
ignored=0 Ansible failed to complete successfully. Any error output should
be visible above. Please fix these errors and try again.
Expected behavior:
The VirtualBox VM should be started, Vagrant should be able to connect to
it (instead I get
default: Warning: Connection refused. Retrying...
over and over, and I can't connect via SSH).
Actual behavior:
Vagrant inside WSL2 can't connect to the VM it just started.
/mnt/c/Users/KeithJames/firewall-role-ak$ service ssh status
* sshd is running
Steps to reproduce:
1.
Install WSL2 on Windows 10 (2004), with Ubuntu bash
2.
Create a directory with the above Vagrantfile in it
3.
Download and install Vagrant for Linux in the WSL2 environment
(regardless of it being installed in Windows)
4.
Run vagrant up
I also tried:
Run vagrant ssh in WSL2.
/mnt/c/Users/KeithJames/firewall-role-ak$ vagrant ssh
/mnt/c/Users/KeithJames/firewall-role-ak$
Then I tried using raw SSH:
/mnt/c/Users/KeithJames/firewall-role-ak$ ssh -p 2222 [email protected]
ssh: connect to host 127.0.0.1 port 2222: Connection refused
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/9f04b0bf-055d-45ff-a442-662b2c8893cdn%40googlegroups.com.