File transfer between 2 vagrant machines.

20 views
Skip to first unread message

codeve...@gmail.com

unread,
Aug 28, 2018, 8:40:45 AM8/28/18
to Vagrant
Scenario:

I have setup 3 vagrant boxes. They consist of a web,db, and a build vm. 

I am using precise 32 Ubuntu boxes. 

The build server starts up last and builds a .war file for my web. 

I am trying to transfer file over to web during the machine boot. 

I am trying to use scp however it requests a password. 


Question:

What syntax be it bash, or python can i use to transfer file.  I am trying to get around transferring keys to my local host.  I just want to make a connection to the web server and copy a file to a directory.

I am looking for the best way. 

Thank You for any assistance.






JP Toto

unread,
Aug 28, 2018, 4:16:32 PM8/28/18
to vagra...@googlegroups.com
The simplest way to do this (assuming Virtualbox) would be to use the shared /vagrant/ folder on your guest VMs. If you're using Vagrant boxes (precise 32) with the host hypervisor tools already installed, when you boot them up they will automatically map /vagrant/ to the root of your project folder on your host desktop in the folder where your Vagrantfile resides.

Any files placed there are automatically available in each VM guest. You could drop your build into /vagrant/ and each of the other VMs will be able to read it automatically.

Alternatively, you could use a shell provisioner in each of the stanzas in your Vagrantfile for your 3 VMs to upload or write out a common ssh key to each guest so that when you SSH files back and forth between them, you won't be prompted for a password. You could echo the common keyfile to /home/vagrant/.ssh/authorized_keys on each guest VM which will allow them to SSH between each other on the same network. This isn't the _most_ secure option but assuming you're working locally, you should be ok.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/e6177889-453b-4cf3-a639-e4e249594b3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
JP Toto   |   james....@gmail.com   |   http://jptoto.jp   |   @jptoto

Alvaro Miranda Aguilera

unread,
Sep 3, 2018, 8:28:45 AM9/3/18
to vagra...@googlegroups.com
if you copy files on /vagrant those will be available on all the boxes.


Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/e6177889-453b-4cf3-a639-e4e249594b3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Alvaro

David Roderiques

unread,
Sep 3, 2018, 6:51:09 PM9/3/18
to vagra...@googlegroups.com
This was great information.  I ended up configuring my build to copy to my vagrant shared folder, and then upon my web up I did a copy to tomcat folder.

Thank you for the help.

Reply all
Reply to author
Forward
0 new messages