You could take a look at wp-cli-ssh
Seamlessly run WP-CLI commands on a remote server via SSH
I know you don't want to SSH to the guest, but this at least, supposedly, removes the need to do it manually.
FiguredI figured out how to set it up.
Follow these steps
mkdir -p ~/.wp-cli
cd ~/.wp-cli
touch composer.json
php composer.phar init --stability dev --no-interaction
php composer.phar config bin-dir bin
php composer.phar config vendor-dir vendor
php composer.phar config repositories.wp-cli composer 'http://wp-cli.org/package-index/'
Create or edit config.yml
in the same folder and add:
require:
- vendor/autoload.php
Install the package with:
php composer.phar require x-team/wp-cli-ssh=dev-master
Then just running wp
should display a list of available subcommands, and you should have ssh
added to that list.
Then we configure the plugin in wp-cli.local.yml
or wp-cli.yml
:
ssh:
vagrant:
# The %pseudotty% placeholder gets replaced with -t or -T depending on whether you're piping output
# The %cmd% placeholder is replaced with the originally-invoked WP-CLI command
cmd: vagrant ssh-config > /tmp/vagrant_ssh_config && ssh -q %pseudotty% -F /tmp/vagrant_ssh_config default %cmd%
# Passed to WP-CLI on the remote server via --url
url: local-www.yourawesomewebsite.com
# We cd to this path on the remote server before running WP-CLI
path: /your/vvv/path/
And run it all with wp ssh plugin status --host=vagrant
... It's just to bad that this plugin assumes Varying-Vagrant-Vagrants. Since my vagrant environment hosts a lot of sites the Vagrantfile isn't in the WordPress directory, breaking the whole thing...