Roots Discourse

Cannot make trellis work on Win10 + WSL2 - vagrant up run to an error : `playbook` does not exist on the guest

Hi everyone,

I am a Windows 10 user, and I’m trying to figure out how to make Trellis Work with windows and WSL2 without success.

My configuration :

  • WSL 2
  • Vagrant 2.2.13 (on both Win10 and WSL2)
  • Ansible 2.7

I also added some configuration to my ~/.bashrc file :

export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
# Telling WSL to use the vagrant version of Windows (* not in the documentation) 
alias vagrant=vagrant.exe

To get to that point I followed the specific Windows 10 user documentation but I had to follow extra steps I wanted to point out, so maybe you can update the documentation :

  1. I couldn’t install pip, I had to install pip3 (not a big deal, but I think you should mentioned it)
  2. While doing a vagrant up the first time, it seems that vagrant was launched on the WSL2 machine, and I get this error : The host path of the shared folder is not supported from WSL. Host path of the shared folder must be located on a file system with DrvFs type. Host path: /mnt/f/.....
    In order to fix that I added the line mentioned above (*) in my ~./bashrc file : alias vagrant=vagrant.exe in order to launch the vagrant version of Win10
    -> I found this fix in this tutorial

So this time, vagrant up is doing something ! But here come the struggle, and I’m stuck to this point…

Here is the output of vagrant up :

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-20.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-20.04' version '202010.24.0' is up to date...
==> default: Setting the name of the VM: example.test
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Exporting NFS shared folders...
==> default: Preparing to edit nfs mounting file.
[NFS] Status: running
==> default: Mounting NFS shared folders...
==> default: Mounting shared folders...
    default: /vagrant => F:/www/Roots/lorem/trellis
==> default: Running provisioner: shell...
    default: Running: inline script
    default: Reading package lists...
    default: Building dependency tree...
    default: Reading state information...
    default: libssl1.1 is already the newest version (1.1.1f-1ubuntu2).
    default: 0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.
==> default: Running provisioner: ansible_local...
`playbook` does not exist on the guest: /home/vagrant/trellis/dev.yml

The playbook cannot be found, so ansible cannot do his job…

After that, a vagrant ssh is working and I noticed that the /home/vagrant folder exists but the folder /home/vagrant/trellis/ does not. So, no surprise, there is no dev.yml either as the error above said

So, did I miss something ? Is there extra step missing in the documentation ? Is this a bug ?
Notice that I’m not very familar with Vagrant, so I really hope some can help :slight_smile:

Thanks in advance !

According to your log, a shared folder is mounted:
/vagrant => F:/www/Roots/lorem/trellis
Does F:/www/Roots/lorem/trellis contain a dev.yml file?

Related (shared on WSL):

yes the dev.yml fil is here

However, it occurs I just find out : it was related to my Vagrant version. I had to downgrade to vagrant 2.2.10 and now it works !

So my issue seems to be more related to this one in some way :

Now it seems that I’m having trouble with my ansible version but seems to be another story !

Thanks