How can I run copy files in vagrant always (not using shared folder)

19 views
Skip to first unread message

Galit Rosenthal

unread,
Feb 20, 2020, 5:10:42 AM2/20/20
to Vagrant
I would like on every vagrant up to be able to copy files from the host to the guest vm and after it run the shell provision.
Shell provision has the option to add "always"
but when copy files I can't do it.

Brian Cain

unread,
Feb 20, 2020, 11:58:19 AM2/20/20
to vagra...@googlegroups.com
Hey there -

You'll want to use the file provisioner:


Thanks!

--
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/f92b8c5a-92f9-4aeb-9bd6-0325e6a4ade1%40googlegroups.com.


--
Brian Cain

Galit R

unread,
Feb 21, 2020, 1:07:21 AM2/21/20
to vagra...@googlegroups.com
I know i can use this functionality
But when i run vagrant up it isnt copying the file again 

בתאריך יום ה׳, 20 בפבר׳ 2020, 18:58, מאת Brian Cain ‏<bc...@hashicorp.com>:

dragon788

unread,
Feb 21, 2020, 8:34:01 AM2/21/20
to Vagrant
You'll need to run `vagrant up --provision` each time. I can't recall if there is an option for `provision always` available in the Vagrantfile on individual provisioners.

I'd recommend just using the rsync shared folder implementation depending on where you are wanting to copy the file.

JP Toto

unread,
Feb 21, 2020, 8:48:24 AM2/21/20
to vagra...@googlegroups.com
You can set the provisioner to run: always, like you mention, and it should copy each time. The file _should_ overwrite an existing one if it's there.  https://www.vagrantup.com/docs/provisioning/basic_usage.html and the file copy will happen each time you "vagrant up".

Vagrant.configure("2") do |config|
  config.vm.provision "shell", inline: "echo hello",
    run: "always"
end

On Fri, Feb 21, 2020 at 8:34 AM dragon788 <drag...@gmail.com> wrote:
You'll need to run `vagrant up --provision` each time. I can't recall if there is an option for `provision always` available in the Vagrantfile on individual provisioners.

I'd recommend just using the rsync shared folder implementation depending on where you are wanting to copy the file.

--
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.


--
JP Toto   |   james....@gmail.com   |   http://jptoto.jp   |   @jptoto
Reply all
Reply to author
Forward
0 new messages