Closed anujsrc closed 6 years ago
Currently, I am using the run
directive to achieve this-
run "ssh -F vagrant-ssh default '/vagrant/start.sh'"
where, vagrant-ssh
is vagrant ssh config-
vagrant ssh-config > vagrant-ssh
or simply
run "ssh -i ./.vagrant/machines/default/virtualbox/private_key ubuntu@172.21.1.11 '/vagrant/start.sh'"
If there is a better way, do let me know. Thanks.
I agree it would be nice to have this as an option to run_remote
. I used
run_remote 'sudo -u vagrant -H /vagrant/start,sh'
You should be able to use
run 'vagrant ssh -c /vagrant/start.sh'
Environment
Issue
Trying to run a script under /vagrant that is owned by the ubuntu user. Also, there are additional environment settings including password-less SSH for ubuntu user. Triggers are fired via root user that may not get those environment variables and other SSH settings of ubuntu user hence the script fails to execute due to component level errors but the trigger does get fired correctly.
Query
Is there a way to run the triggers as a specific user?