Cloufish
Cloufish

Reputation: 23

vm.provision "file" does not copy the files to the guest machine

I wanted to copy the files from the host machine to the guest machine with

  Vagrant.configure("2") do |config|
    # ... other configuration
    config.vm.provision "file", source: ".sudoers", destination: "/etc/sudoers"
    config.vm.provision "file", source: ".pacman.conf", destination: "/usr/local/etc/pacman.conf"
    config.vm.provision "file", source: ".setup.sh", destination: "/home/vagrant/setup.sh"
  end

But this doesn't work at all! When doing vagrant up no error output is presented to me. The VM provision "file" is right between "Mounting shared folders" and "running provisioner: shell"

enter image description here

If there's any info I can provide I will do that!

Upvotes: 1

Views: 579

Answers (1)

rassakra
rassakra

Reputation: 1121

  • you can use a shared folder to share data between your host and your VM, this is the first solution .
  • Else you can use the provision file like that:
  Vagrant.configure("2") do |config|
    # ... other configuration
    config.vm.provision "file", source: "./sudoers", destination: "/etc/sudoers"
    config.vm.provision "file", source: "./pacman.conf", destination: "/usr/local/etc/pacman.conf"
    config.vm.provision "file", source: "./setup.sh", destination: "/home/vagrant/setup.sh"
  end

In your case the error is related to the path of the local files .

I hope that this help you to fix your issue.

Upvotes: 1

Related Questions