Logrotate outputting /wrong/ error?

While trying to install Trellis, I get an error from logrotate {{ ansible_user }}: 'ansible_user' is undefined
This is after all the other installing successful.

The only change I made to the default trellis 1.20.0 was in vagrant.default.yml vagrant_ansible_version: '2.10.17' [it was 2.10.7 but that wasn’t what got installed.

fatal: [default]: FAILED! => {"msg": "[{'name': 'wordpress-sites', 'path': '{{ www_root }}/**/logs/*.log', 'options': ['weekly', 'maxsize 50M', 'missingok', 'rotate 8', 'compress', 'delaycompress', 'notifempty', 'create 0640 {{ web_user }} {{ web_group }}', 'sharedscripts'], 'scripts': {'prerotate': 'if [ -d /etc/logrotate.d/httpd-prerotate ]; then \\\\\\n      run-parts /etc/logrotate.d/httpd-prerotate; \\\\\\n    fi \\\\\\n', 'postrotate': 'service nginx reload >/dev/null 2>&1'}}]: {{ ansible_user }}: 'ansible_user' is undefined"}

If I ssh into the machine, /etc/logrotate.d/httpd-prerotate doesnt even exist…

While trying to install Trellis

What command are you running more specifically? I’m assuming this is during a vagrant up (or trellis up)?

Can you paste more of the log output please?

Didnt mention i am using Windows.
Really tried following the docs to the letter here.

Running vagrant up.
The docs say to treat all commands as WSL commands, however running trellis up or vagrant up inside the wsl complains about access to the host from VirtualBox it, and i did try to run down that rabbit hole.

Full log [discource wont let me post full log] : https://zerobin.net/?87fbc937c26758ec#Nx7WIZlUMo811d/ExfXX7ZUT7KbAzSDuvxQkCzd7RPo= pwd is sovagrant

Thanks for the logs; it helped me figure out what was happening.

I just merged a fix for the bug you ran into: Fix ansible_user references for local provisioning by swalkinshaw · Pull Request #1479 · roots/trellis · GitHub

You can manually apply those changes and let me know if it fixes it.


Here’s a brief explanation of what happened:

  • Trellis’ Vagrant integration tries to make getting started easier, so if no installation of Ansible is found on your host machine, Vagrant will use “local provisioning” where it will automatically install Ansibles on the Vagrant VM and run it all from the VM.
  • We recommend everyone uses trellis-cli because it handles dependency installation (including Ansible) on your host machine. If your project was created with trellis-cli, then Vagrant will recognize that Ansible exists and not use that local provisioning mode.
  • Since you did create your project with trellis-cli (on WSL I assume?) but then switched to Windows to run vagrant up (due to other issues), Ansible wouldn’t be found on the Windows side
  • This triggered that “local provisioning” mode I mentioned which exposed a bug.

Ideally you’re able to figure out the issues on WSL and use that for everything as recommended. Feel free to post a new thread with details on your WSL issues if you need help.


Thanks, good job!
I manually changed the files and now provision runs and completes.

Is it true the vagrant up and trellis up are mostly the same though? Or are the benefits to running trellis up - i mean mostly after the initial provisioning has run succefully.

I can defiantly do another WSL issue and explain it. see you there =]

trellis up just runs vagrant up under the hood so they’re basically the same. The trellis CLI command is mainly a convenience method since most commands that get run otherwise are with trellis.