As of part 2 of my post I'm proposing to add "SSHCommand" setting to system settings or to /system/config.php
Then in deployment script we can use this setting to execute commands on Host OS (e.g. Windows/Mac) from Guest OS (e.g. Linux) installed on Virtual Machine, where In-Portal is installed.
If you're using Windows as your Host OS, then it you need to install SSH server separately.
However if anybody can find a way to run commands from Guest OS on Host OS via VMWare tools or something, then please let me know.